Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/gohugoio/hugo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2020-02-19 12:39:36 +0300
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2020-02-19 19:14:35 +0300
commit0b96aba022d51cf9939605c029bb8dba806653a1 (patch)
treef7d2883a6ea85546e4e9536f6ccfb184bc4293af /commands
parentfa520a2d983b982394ad10088393fb303e48980a (diff)
commands: Add "hugo mod verify"
See #6907
Diffstat (limited to 'commands')
-rw-r--r--commands/mod.go22
1 files changed, 22 insertions, 0 deletions
diff --git a/commands/mod.go b/commands/mod.go
index 582ebfda7..61e3c74e6 100644
--- a/commands/mod.go
+++ b/commands/mod.go
@@ -29,7 +29,28 @@ type modCmd struct {
*baseBuilderCmd
}
+func (c *modCmd) newVerifyCmd() *cobra.Command {
+ var clean bool
+
+ verifyCmd := &cobra.Command{
+ Use: "verify",
+ Short: "Verify dependencies.",
+ Long: `Verify checks that the dependencies of the current module, which are stored in a local downloaded source cache, have not been modified since being downloaded.
+`,
+ RunE: func(cmd *cobra.Command, args []string) error {
+ return c.withModsClient(true, func(c *modules.Client) error {
+ return c.Verify(clean)
+ })
+ },
+ }
+
+ verifyCmd.Flags().BoolVarP(&clean, "clean", "", false, "delete module cache for dependencies that fail verification")
+
+ return verifyCmd
+}
+
func (b *commandsBuilder) newModCmd() *modCmd {
+
c := &modCmd{}
const commonUsage = `
@@ -184,6 +205,7 @@ If a module is vendored, that is where Hugo will look for it's dependencies.
})
},
},
+ c.newVerifyCmd(),
&cobra.Command{
Use: "tidy",
Short: "Remove unused entries in go.mod and go.sum.",