Skip to content

Commit

Permalink
fix(goreleaser): remove go mod tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom Morelly committed Feb 15, 2023
1 parent a7547c2 commit 8d9ae3d
Show file tree
Hide file tree
Showing 14 changed files with 84 additions and 12 deletions.
11 changes: 4 additions & 7 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ env:

before:
hooks:
- go mod tidy
- ./scripts/manpages.sh
- ./scripts/completions.sh

Expand Down Expand Up @@ -38,8 +37,8 @@ nfpms:
- vops
vendor: FalcoSuessgott
homepage: https://github.com/FalcoSuessgott/vops
maintainer: "Tom Morelly <[email protected]>"
description: "recursively list secrets from Vaults KV2 engine in various formats"
maintainer: "Tom Morelly <[email protected]>"
description: "a HashiCorp Vault cluster management tool"
license: GPL-3.0
formats:
- apk
Expand Down Expand Up @@ -73,10 +72,9 @@ dockers:
build_flag_templates:
- "--pull"
- "--label=io.artifacthub.package.readme-url=https://raw.githubusercontent.com/FalcoSuessgott/vops/master/README.md"
- "--label=io.artifacthub.package.logo-url=https://raw.githubusercontent.com/FalcoSuessgott/vops/master/www/static/images/logo.png"
- "--label=io.artifacthub.package.maintainers=[{\"name\":\"Tom Morelly\",\"email\":\"[email protected]\"}]"
- "--label=io.artifacthub.package.license=MIT"
- "--label=org.opencontainers.image.description=the swiss army knife when working with Vault KVv2 engines"
- "--label=org.opencontainers.image.description=a HashiCorp Vault cluster management tool"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.name={{.ProjectName}}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
Expand All @@ -91,10 +89,9 @@ dockers:
build_flag_templates:
- "--pull"
- "--label=io.artifacthub.package.readme-url=https://raw.githubusercontent.com/FalcoSuessgott/vops/master/README.md"
- "--label=io.artifacthub.package.logo-url=https://raw.githubusercontent.com/FalcoSuessgott/vops/master/www/static/images/logo.png"
- "--label=io.artifacthub.package.maintainers=[{\"name\":\"Tom Morelly\",\"email\":\"[email protected]\"}]"
- "--label=io.artifacthub.package.license=MIT"
- "--label=org.opencontainers.image.description=the swiss army knife when working with Vault KVv2 engines"
- "--label=org.opencontainers.image.description=a HashiCorp Vault cluster management tool"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.name={{.ProjectName}}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,5 @@ token: ## copies vault token in clipboard buffer

.PHONY: clean
clean: ## clean the development vault
@rm -rf coverage.out dist/ $(projectname) manpages/ dist/ completions/ assets/raft/* || true
@rm -rf snapshots/ coverage.out dist/ $(projectname) manpages/ dist/ completions/ assets/raft/* || true
@kill -9 $(shell pgrep -x vault) 2> /dev/null || true
3 changes: 3 additions & 0 deletions cmd/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ func NewConfigCmd(cfg string) *cobra.Command {
Short: "config",
SilenceUsage: true,
SilenceErrors: true,
PreRunE: func(cmd *cobra.Command, args []string) error {
return config.ValidateConfig(cfg)
},
RunE: func(cmd *cobra.Command, args []string) error {
return cmd.Help()
},
Expand Down
3 changes: 3 additions & 0 deletions cmd/generate_root/generate_root.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ func NewGenerateRootCmd(cfg string) *cobra.Command {
Short: "generates a new root token for a single or all cluster",
SilenceUsage: true,
SilenceErrors: true,
PreRunE: func(cmd *cobra.Command, args []string) error {
return config.ValidateConfig(cfg)
},
RunE: func(cmd *cobra.Command, args []string) error {
fmt.Println("[ Generate Root Token ]")
fmt.Printf("using %s\n", cfg)
Expand Down
3 changes: 3 additions & 0 deletions cmd/initialize/initialize.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ func NewInitCmd(cfg string) *cobra.Command {
Short: "initialize a vault cluster",
SilenceUsage: true,
SilenceErrors: true,
PreRunE: func(cmd *cobra.Command, args []string) error {
return config.ValidateConfig(cfg)
},
RunE: func(cmd *cobra.Command, args []string) error {
fmt.Println("[ Intialization ]")
fmt.Printf("using %s\n", cfg)
Expand Down
43 changes: 43 additions & 0 deletions cmd/manpage/manpage.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package manpage

import (
"fmt"
"os"

mcoral "github.com/muesli/mango-cobra"
"github.com/muesli/roff"
"github.com/spf13/cobra"
)

// ManCmd manpage command.
type ManCmd struct {
Cmd *cobra.Command
}

// NewManCmd manpage cmd.
func NewManCmd() *ManCmd {
root := &ManCmd{}

c := &cobra.Command{
Use: "man",
Short: "Generates GoReleaser's command line manpages",
SilenceUsage: true,
DisableFlagsInUseLine: true,
Hidden: true,
Args: cobra.NoArgs,
RunE: func(cmd *cobra.Command, args []string) error {
manPage, err := mcoral.NewManPage(1, root.Cmd.Root())
if err != nil {
return err
}

_, err = fmt.Fprint(os.Stdout, manPage.Build(roff.NewDocument()))

return err
},
}

root.Cmd = c

return root
}
3 changes: 3 additions & 0 deletions cmd/rekey/rekey.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ func NewRekeyCmd(cfg string) *cobra.Command {
Short: "rekey a single or all vault cluster",
SilenceUsage: true,
SilenceErrors: true,
PreRunE: func(cmd *cobra.Command, args []string) error {
return config.ValidateConfig(cfg)
},
RunE: func(cmd *cobra.Command, args []string) error {
fmt.Println("[ Rekeying ]")
fmt.Printf("using %s\n", cfg)
Expand Down
6 changes: 2 additions & 4 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ import (
"github.com/FalcoSuessgott/vops/cmd/config"
"github.com/FalcoSuessgott/vops/cmd/generate_root"
"github.com/FalcoSuessgott/vops/cmd/initialize"
"github.com/FalcoSuessgott/vops/cmd/manpage"
"github.com/FalcoSuessgott/vops/cmd/rekey"
"github.com/FalcoSuessgott/vops/cmd/seal"
"github.com/FalcoSuessgott/vops/cmd/snapshot"
"github.com/FalcoSuessgott/vops/cmd/unseal"
"github.com/FalcoSuessgott/vops/cmd/version"
cfg "github.com/FalcoSuessgott/vops/pkg/config"
"github.com/spf13/cobra"
)

Expand All @@ -32,9 +32,6 @@ func NewRootCmd(v string, writer io.Writer) *cobra.Command {
Short: "A HashiCorp Vault cluster operations tool",
SilenceUsage: true,
SilenceErrors: true,
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
return cfg.ValidateConfig(cfgFile)
},
RunE: func(cmd *cobra.Command, args []string) error {
return cmd.Help()
},
Expand All @@ -53,6 +50,7 @@ func NewRootCmd(v string, writer io.Writer) *cobra.Command {
config.NewConfigCmd(cfgFile),
snapshot.NewSnapshotCmd(cfgFile),
config.NewConfigCmd(cfgFile),
manpage.NewManCmd().Cmd,
)

return cmd
Expand Down
3 changes: 3 additions & 0 deletions cmd/seal/seal.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ func NewSealCmd(cfg string) *cobra.Command {
Short: "seals a single or all cluster",
SilenceUsage: true,
SilenceErrors: true,
PreRunE: func(cmd *cobra.Command, args []string) error {
return config.ValidateConfig(cfg)
},
RunE: func(cmd *cobra.Command, args []string) error {
fmt.Println("[ Seal ]")
fmt.Printf("using %s\n", cfg)
Expand Down
3 changes: 3 additions & 0 deletions cmd/snapshot/snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ func NewSnapshotCmd(cfg string) *cobra.Command {
Short: "creates or restorees a snapshot from a single or all vault cluster",
SilenceUsage: true,
SilenceErrors: true,
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
return config.ValidateConfig(cfg)
},
RunE: func(cmd *cobra.Command, args []string) error {
return cmd.Help()
},
Expand Down
3 changes: 3 additions & 0 deletions cmd/unseal/unseal.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ func NewUnsealCmd(cfg string) *cobra.Command {
Short: "unseal a single node or a single cluster or all cluster",
SilenceUsage: true,
SilenceErrors: true,
PreRunE: func(cmd *cobra.Command, args []string) error {
return config.ValidateConfig(cfg)
},
RunE: func(cmd *cobra.Command, args []string) error {
fmt.Println("[ Unseal ]")
fmt.Printf("using %s\n", cfg)
Expand Down
4 changes: 4 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ require (
github.com/ghodss/yaml v1.0.1-0.20190212211648-25d852aebe32
github.com/hashicorp/vault/api v1.9.0
github.com/hashicorp/vault/sdk v0.6.1-0.20221010215534-6545e24b6023
github.com/muesli/mango-cobra v1.2.0
github.com/muesli/roff v0.1.0
github.com/spf13/cobra v1.6.1
github.com/stretchr/testify v1.8.2-0.20221102114659-1333b5d3bda8
gopkg.in/yaml.v3 v3.0.1
Expand Down Expand Up @@ -34,6 +36,8 @@ require (
github.com/mattn/go-isatty v0.0.16 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/muesli/mango v0.1.0 // indirect
github.com/muesli/mango-pflag v0.1.0 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/rogpeppe/go-internal v1.8.1 // indirect
github.com/ryanuber/go-glob v1.0.0 // indirect
Expand Down
8 changes: 8 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,14 @@ github.com/mitchellh/go-wordwrap v1.0.0/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUb
github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
github.com/muesli/mango v0.1.0 h1:DZQK45d2gGbql1arsYA4vfg4d7I9Hfx5rX/GCmzsAvI=
github.com/muesli/mango v0.1.0/go.mod h1:5XFpbC8jY5UUv89YQciiXNlbi+iJgt29VDC5xbzrLL4=
github.com/muesli/mango-cobra v1.2.0 h1:DQvjzAM0PMZr85Iv9LIMaYISpTOliMEg+uMFtNbYvWg=
github.com/muesli/mango-cobra v1.2.0/go.mod h1:vMJL54QytZAJhCT13LPVDfkvCUJ5/4jNUKF/8NC2UjA=
github.com/muesli/mango-pflag v0.1.0 h1:UADqbYgpUyRoBja3g6LUL+3LErjpsOwaC9ywvBWe7Sg=
github.com/muesli/mango-pflag v0.1.0/go.mod h1:YEQomTxaCUp8PrbhFh10UfbhbQrM/xJ4i2PB8VTLLW0=
github.com/muesli/roff v0.1.0 h1:YD0lalCotmYuF5HhZliKWlIx7IEhiXeSfq7hNjFqGF8=
github.com/muesli/roff v0.1.0/go.mod h1:pjAHQM9hdUUwm/krAfrLGgJkXJ+YuhtsfZ42kieB2Ig=
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
Expand Down
1 change: 1 addition & 0 deletions scripts/completions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
set -e
rm -rf completions
mkdir completions

for sh in bash zsh fish; do
go run main.go completion "$sh" >"completions/vops.$sh"
done

0 comments on commit 8d9ae3d

Please sign in to comment.