mirror of https://github.com/docker/docs.git
Fixing golint
Signed-off-by: Diogo Monica <diogo@docker.com>
This commit is contained in:
parent
579f51866b
commit
e7fb8ab46c
|
|
@ -54,9 +54,9 @@ func keysRemoveRootKey(cmd *cobra.Command, args []string) {
|
|||
}
|
||||
parseConfig()
|
||||
|
||||
keyStoreManager, err := keystoremanager.NewKeyStoreManager(TrustDir, retriever)
|
||||
keyStoreManager, err := keystoremanager.NewKeyStoreManager(trustDir, retriever)
|
||||
if err != nil {
|
||||
fatalf("failed to create a new truststore manager with directory: %s", TrustDir)
|
||||
fatalf("failed to create a new truststore manager with directory: %s", trustDir)
|
||||
}
|
||||
|
||||
// List all the keys about to be removed
|
||||
|
|
@ -85,9 +85,9 @@ func keysList(cmd *cobra.Command, args []string) {
|
|||
|
||||
parseConfig()
|
||||
|
||||
keyStoreManager, err := keystoremanager.NewKeyStoreManager(TrustDir, retriever)
|
||||
keyStoreManager, err := keystoremanager.NewKeyStoreManager(trustDir, retriever)
|
||||
if err != nil {
|
||||
fatalf("failed to create a new truststore manager with directory: %s", TrustDir)
|
||||
fatalf("failed to create a new truststore manager with directory: %s", trustDir)
|
||||
}
|
||||
|
||||
fmt.Println("")
|
||||
|
|
@ -128,9 +128,9 @@ func keysGenerateRootKey(cmd *cobra.Command, args []string) {
|
|||
|
||||
parseConfig()
|
||||
|
||||
keyStoreManager, err := keystoremanager.NewKeyStoreManager(TrustDir, retriever)
|
||||
keyStoreManager, err := keystoremanager.NewKeyStoreManager(trustDir, retriever)
|
||||
if err != nil {
|
||||
fatalf("failed to create a new truststore manager with directory: %s", TrustDir)
|
||||
fatalf("failed to create a new truststore manager with directory: %s", trustDir)
|
||||
}
|
||||
|
||||
keyID, err := keyStoreManager.GenRootKey(algorithm)
|
||||
|
|
|
|||
|
|
@ -18,9 +18,9 @@ const defaultTrustDir string = ".notary/"
|
|||
const defaultServerURL = "https://notary-server:4443"
|
||||
|
||||
var rawOutput bool
|
||||
var TrustDir string
|
||||
var RemoteTrustServer string
|
||||
var Verbose bool
|
||||
var trustDir string
|
||||
var remoteTrustServer string
|
||||
var verbose bool
|
||||
var retriever passphrase.Retriever
|
||||
|
||||
func init() {
|
||||
|
|
@ -28,12 +28,12 @@ func init() {
|
|||
}
|
||||
|
||||
func parseConfig() {
|
||||
if Verbose {
|
||||
if verbose {
|
||||
logrus.SetLevel(logrus.DebugLevel)
|
||||
logrus.SetOutput(os.Stderr)
|
||||
}
|
||||
|
||||
if TrustDir == "" {
|
||||
if trustDir == "" {
|
||||
// Retrieve current user to get home directory
|
||||
usr, err := user.Current()
|
||||
if err != nil {
|
||||
|
|
@ -45,16 +45,16 @@ func parseConfig() {
|
|||
if homeDir == "" {
|
||||
fatalf("cannot get current user home directory")
|
||||
}
|
||||
TrustDir = filepath.Join(homeDir, filepath.Dir(defaultTrustDir))
|
||||
trustDir = filepath.Join(homeDir, filepath.Dir(defaultTrustDir))
|
||||
|
||||
logrus.Debugf("no trust directory provided, using default: %s", TrustDir)
|
||||
logrus.Debugf("no trust directory provided, using default: %s", trustDir)
|
||||
} else {
|
||||
logrus.Debugf("trust directory provided: %s", TrustDir)
|
||||
logrus.Debugf("trust directory provided: %s", trustDir)
|
||||
}
|
||||
|
||||
// Setup the configuration details
|
||||
viper.SetConfigName(configFileName)
|
||||
viper.AddConfigPath(TrustDir)
|
||||
viper.AddConfigPath(trustDir)
|
||||
viper.SetConfigType("json")
|
||||
|
||||
// Find and read the config file
|
||||
|
|
@ -75,22 +75,22 @@ func main() {
|
|||
Long: "notary allows the creation and management of collections of signed targets, allowing the signing and validation of arbitrary content.",
|
||||
}
|
||||
|
||||
NotaryCmd.PersistentFlags().StringVarP(&TrustDir, "trustdir", "d", "", "directory where the trust data is persisted to")
|
||||
NotaryCmd.PersistentFlags().BoolVarP(&Verbose, "verbose", "v", false, "verbose output")
|
||||
NotaryCmd.PersistentFlags().StringVarP(&trustDir, "trustdir", "d", "", "directory where the trust data is persisted to")
|
||||
NotaryCmd.PersistentFlags().BoolVarP(&verbose, "verbose", "v", false, "verbose output")
|
||||
|
||||
NotaryCmd.AddCommand(cmdKeys)
|
||||
NotaryCmd.AddCommand(cmdTufInit)
|
||||
cmdTufInit.Flags().StringVarP(&RemoteTrustServer, "server", "s", defaultServerURL, "Remote trust server location")
|
||||
cmdTufInit.Flags().StringVarP(&remoteTrustServer, "server", "s", defaultServerURL, "Remote trust server location")
|
||||
NotaryCmd.AddCommand(cmdTufList)
|
||||
cmdTufList.Flags().BoolVarP(&rawOutput, "raw", "", false, "Instructs notary list to output a nonpretty printed version of the targets list. Useful if you need to parse the list.")
|
||||
cmdTufList.Flags().StringVarP(&RemoteTrustServer, "server", "s", defaultServerURL, "Remote trust server location")
|
||||
cmdTufList.Flags().StringVarP(&remoteTrustServer, "server", "s", defaultServerURL, "Remote trust server location")
|
||||
NotaryCmd.AddCommand(cmdTufAdd)
|
||||
NotaryCmd.AddCommand(cmdTufRemove)
|
||||
NotaryCmd.AddCommand(cmdTufPublish)
|
||||
cmdTufPublish.Flags().StringVarP(&RemoteTrustServer, "server", "s", defaultServerURL, "Remote trust server location")
|
||||
cmdTufPublish.Flags().StringVarP(&remoteTrustServer, "server", "s", defaultServerURL, "Remote trust server location")
|
||||
NotaryCmd.AddCommand(cmdTufLookup)
|
||||
cmdTufLookup.Flags().BoolVarP(&rawOutput, "raw", "", false, "Instructs notary lookup to output a nonpretty printed version of the targets list. Useful if you need to parse the list.")
|
||||
cmdTufLookup.Flags().StringVarP(&RemoteTrustServer, "server", "s", defaultServerURL, "Remote trust server location")
|
||||
cmdTufLookup.Flags().StringVarP(&remoteTrustServer, "server", "s", defaultServerURL, "Remote trust server location")
|
||||
NotaryCmd.AddCommand(cmdVerify)
|
||||
|
||||
NotaryCmd.Execute()
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ func tufAdd(cmd *cobra.Command, args []string) {
|
|||
|
||||
parseConfig()
|
||||
|
||||
nRepo, err := notaryclient.NewNotaryRepository(TrustDir, gun, RemoteTrustServer, getTransport(), retriever)
|
||||
nRepo, err := notaryclient.NewNotaryRepository(trustDir, gun, remoteTrustServer, getTransport(), retriever)
|
||||
if err != nil {
|
||||
fatalf(err.Error())
|
||||
}
|
||||
|
|
@ -102,7 +102,7 @@ func tufInit(cmd *cobra.Command, args []string) {
|
|||
gun := args[0]
|
||||
parseConfig()
|
||||
|
||||
nRepo, err := notaryclient.NewNotaryRepository(TrustDir, gun, RemoteTrustServer, getTransport(), retriever)
|
||||
nRepo, err := notaryclient.NewNotaryRepository(trustDir, gun, remoteTrustServer, getTransport(), retriever)
|
||||
if err != nil {
|
||||
fatalf(err.Error())
|
||||
}
|
||||
|
|
@ -139,7 +139,7 @@ func tufList(cmd *cobra.Command, args []string) {
|
|||
gun := args[0]
|
||||
parseConfig()
|
||||
|
||||
nRepo, err := notaryclient.NewNotaryRepository(TrustDir, gun, RemoteTrustServer, getTransport(), retriever)
|
||||
nRepo, err := notaryclient.NewNotaryRepository(trustDir, gun, remoteTrustServer, getTransport(), retriever)
|
||||
if err != nil {
|
||||
fatalf(err.Error())
|
||||
}
|
||||
|
|
@ -165,7 +165,7 @@ func tufLookup(cmd *cobra.Command, args []string) {
|
|||
targetName := args[1]
|
||||
parseConfig()
|
||||
|
||||
nRepo, err := notaryclient.NewNotaryRepository(TrustDir, gun, RemoteTrustServer, getTransport(), retriever)
|
||||
nRepo, err := notaryclient.NewNotaryRepository(trustDir, gun, remoteTrustServer, getTransport(), retriever)
|
||||
if err != nil {
|
||||
fatalf(err.Error())
|
||||
}
|
||||
|
|
@ -189,7 +189,7 @@ func tufPublish(cmd *cobra.Command, args []string) {
|
|||
|
||||
fmt.Println("Pushing changes to ", gun, ".")
|
||||
|
||||
nRepo, err := notaryclient.NewNotaryRepository(TrustDir, gun, RemoteTrustServer, getTransport(), retriever)
|
||||
nRepo, err := notaryclient.NewNotaryRepository(trustDir, gun, remoteTrustServer, getTransport(), retriever)
|
||||
if err != nil {
|
||||
fatalf(err.Error())
|
||||
}
|
||||
|
|
@ -235,7 +235,7 @@ func verify(cmd *cobra.Command, args []string) {
|
|||
|
||||
gun := args[0]
|
||||
targetName := args[1]
|
||||
nRepo, err := notaryclient.NewNotaryRepository(TrustDir, gun, RemoteTrustServer, getTransport(), retriever)
|
||||
nRepo, err := notaryclient.NewNotaryRepository(trustDir, gun, remoteTrustServer, getTransport(), retriever)
|
||||
if err != nil {
|
||||
fatalf(err.Error())
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue