Fixing golint

Signed-off-by: Diogo Monica <diogo@docker.com>
This commit is contained in:
Diogo Monica 2015-07-27 22:29:21 -07:00
parent 579f51866b
commit e7fb8ab46c
3 changed files with 27 additions and 27 deletions

View File

@ -54,9 +54,9 @@ func keysRemoveRootKey(cmd *cobra.Command, args []string) {
} }
parseConfig() parseConfig()
keyStoreManager, err := keystoremanager.NewKeyStoreManager(TrustDir, retriever) keyStoreManager, err := keystoremanager.NewKeyStoreManager(trustDir, retriever)
if err != nil { 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 // List all the keys about to be removed
@ -85,9 +85,9 @@ func keysList(cmd *cobra.Command, args []string) {
parseConfig() parseConfig()
keyStoreManager, err := keystoremanager.NewKeyStoreManager(TrustDir, retriever) keyStoreManager, err := keystoremanager.NewKeyStoreManager(trustDir, retriever)
if err != nil { 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("") fmt.Println("")
@ -128,9 +128,9 @@ func keysGenerateRootKey(cmd *cobra.Command, args []string) {
parseConfig() parseConfig()
keyStoreManager, err := keystoremanager.NewKeyStoreManager(TrustDir, retriever) keyStoreManager, err := keystoremanager.NewKeyStoreManager(trustDir, retriever)
if err != nil { 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) keyID, err := keyStoreManager.GenRootKey(algorithm)

View File

@ -18,9 +18,9 @@ const defaultTrustDir string = ".notary/"
const defaultServerURL = "https://notary-server:4443" const defaultServerURL = "https://notary-server:4443"
var rawOutput bool var rawOutput bool
var TrustDir string var trustDir string
var RemoteTrustServer string var remoteTrustServer string
var Verbose bool var verbose bool
var retriever passphrase.Retriever var retriever passphrase.Retriever
func init() { func init() {
@ -28,12 +28,12 @@ func init() {
} }
func parseConfig() { func parseConfig() {
if Verbose { if verbose {
logrus.SetLevel(logrus.DebugLevel) logrus.SetLevel(logrus.DebugLevel)
logrus.SetOutput(os.Stderr) logrus.SetOutput(os.Stderr)
} }
if TrustDir == "" { if trustDir == "" {
// Retrieve current user to get home directory // Retrieve current user to get home directory
usr, err := user.Current() usr, err := user.Current()
if err != nil { if err != nil {
@ -45,16 +45,16 @@ func parseConfig() {
if homeDir == "" { if homeDir == "" {
fatalf("cannot get current user home directory") 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 { } else {
logrus.Debugf("trust directory provided: %s", TrustDir) logrus.Debugf("trust directory provided: %s", trustDir)
} }
// Setup the configuration details // Setup the configuration details
viper.SetConfigName(configFileName) viper.SetConfigName(configFileName)
viper.AddConfigPath(TrustDir) viper.AddConfigPath(trustDir)
viper.SetConfigType("json") viper.SetConfigType("json")
// Find and read the config file // 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.", 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().StringVarP(&trustDir, "trustdir", "d", "", "directory where the trust data is persisted to")
NotaryCmd.PersistentFlags().BoolVarP(&Verbose, "verbose", "v", false, "verbose output") NotaryCmd.PersistentFlags().BoolVarP(&verbose, "verbose", "v", false, "verbose output")
NotaryCmd.AddCommand(cmdKeys) NotaryCmd.AddCommand(cmdKeys)
NotaryCmd.AddCommand(cmdTufInit) 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) 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().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(cmdTufAdd)
NotaryCmd.AddCommand(cmdTufRemove) NotaryCmd.AddCommand(cmdTufRemove)
NotaryCmd.AddCommand(cmdTufPublish) 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) 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().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.AddCommand(cmdVerify)
NotaryCmd.Execute() NotaryCmd.Execute()

View File

@ -77,7 +77,7 @@ func tufAdd(cmd *cobra.Command, args []string) {
parseConfig() parseConfig()
nRepo, err := notaryclient.NewNotaryRepository(TrustDir, gun, RemoteTrustServer, getTransport(), retriever) nRepo, err := notaryclient.NewNotaryRepository(trustDir, gun, remoteTrustServer, getTransport(), retriever)
if err != nil { if err != nil {
fatalf(err.Error()) fatalf(err.Error())
} }
@ -102,7 +102,7 @@ func tufInit(cmd *cobra.Command, args []string) {
gun := args[0] gun := args[0]
parseConfig() parseConfig()
nRepo, err := notaryclient.NewNotaryRepository(TrustDir, gun, RemoteTrustServer, getTransport(), retriever) nRepo, err := notaryclient.NewNotaryRepository(trustDir, gun, remoteTrustServer, getTransport(), retriever)
if err != nil { if err != nil {
fatalf(err.Error()) fatalf(err.Error())
} }
@ -139,7 +139,7 @@ func tufList(cmd *cobra.Command, args []string) {
gun := args[0] gun := args[0]
parseConfig() parseConfig()
nRepo, err := notaryclient.NewNotaryRepository(TrustDir, gun, RemoteTrustServer, getTransport(), retriever) nRepo, err := notaryclient.NewNotaryRepository(trustDir, gun, remoteTrustServer, getTransport(), retriever)
if err != nil { if err != nil {
fatalf(err.Error()) fatalf(err.Error())
} }
@ -165,7 +165,7 @@ func tufLookup(cmd *cobra.Command, args []string) {
targetName := args[1] targetName := args[1]
parseConfig() parseConfig()
nRepo, err := notaryclient.NewNotaryRepository(TrustDir, gun, RemoteTrustServer, getTransport(), retriever) nRepo, err := notaryclient.NewNotaryRepository(trustDir, gun, remoteTrustServer, getTransport(), retriever)
if err != nil { if err != nil {
fatalf(err.Error()) fatalf(err.Error())
} }
@ -189,7 +189,7 @@ func tufPublish(cmd *cobra.Command, args []string) {
fmt.Println("Pushing changes to ", gun, ".") 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 { if err != nil {
fatalf(err.Error()) fatalf(err.Error())
} }
@ -235,7 +235,7 @@ func verify(cmd *cobra.Command, args []string) {
gun := args[0] gun := args[0]
targetName := args[1] targetName := args[1]
nRepo, err := notaryclient.NewNotaryRepository(TrustDir, gun, RemoteTrustServer, getTransport(), retriever) nRepo, err := notaryclient.NewNotaryRepository(trustDir, gun, remoteTrustServer, getTransport(), retriever)
if err != nil { if err != nil {
fatalf(err.Error()) fatalf(err.Error())
} }