Skip to content

Commit e56ad06

Browse files
committed
linter
1 parent 0dfcdcd commit e56ad06

3 files changed

Lines changed: 24 additions & 18 deletions

File tree

cmd/clone.go

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,15 @@ var tag string
3030
func init() {
3131
devctlCmd.AddCommand(cloneCmd)
3232

33-
cloneCmd.Flags().BoolVarP(&gitlab, "gitlab", "l", false, "Clone from gitlab url")
33+
cloneCmd.Flags().BoolVarP(&gitlab, "gitlab", "l", false, "Clone from gitlab URL")
3434
cloneCmd.Flags().StringVarP(&tag, "tag", "t", "", "subfolder to clone repo to")
3535
}
3636

3737
type cloneConfig struct {
3838
Repo string
3939
User string
4040
Host string
41-
Url string
41+
URL string
4242
SourceDir string
4343
command *cobra.Command
4444
}
@@ -58,7 +58,7 @@ func clone(cmd *cobra.Command, args []string) {
5858
cfg.parseArgs(args)
5959

6060
cfg.setSourceDir()
61-
cfg.setUrl()
61+
cfg.setURL()
6262
// validate(cfg)
6363
cfg.clone()
6464
}
@@ -86,18 +86,18 @@ func isFullURL(s string) bool {
8686
return false
8787
}
8888

89-
func (cfg *cloneConfig) parseFullURL(url string) {
89+
func (cfg *cloneConfig) parseFullURL(URL string) {
9090
r, _ := regexp.Compile(`^(?:git@|https?:\/\/(?:.*?@)?)([^\/:]*)(?:\/|:)(.*?)\/(.*?)(?:.git)?$`)
91-
res := r.FindAllStringSubmatch(url, -1)
91+
res := r.FindAllStringSubmatch(URL, -1)
9292

9393
cfg.Host = res[0][1]
9494
cfg.User = res[0][2]
9595
cfg.Repo = res[0][3]
96-
cfg.Url = url
96+
cfg.URL = URL
9797
}
9898

9999
func (cfg *cloneConfig) github() {
100-
cfg.Url = "github.com"
100+
cfg.URL = "github.com"
101101
cfg.Host = "github.com"
102102
user := parser.DevctlConfig.GithubUser
103103
if user != "" {
@@ -106,11 +106,11 @@ func (cfg *cloneConfig) github() {
106106
}
107107

108108
func (cfg *cloneConfig) gitlab() {
109-
cfg.Url = parser.DevctlConfig.GitlabURL
109+
cfg.URL = parser.DevctlConfig.GitlabURL
110110
cfg.Host = parser.DevctlConfig.GitlabURL
111-
if cfg.Url == "" {
112-
printer.Warning("Gitlab url not provided, falling back to gitlab.com")
113-
cfg.Url = "gitlab.com"
111+
if cfg.URL == "" {
112+
printer.Warning("Gitlab URL not provided, falling back to gitlab.com")
113+
cfg.URL = "gitlab.com"
114114
cfg.Host = "gitlab.com"
115115
}
116116

@@ -132,9 +132,9 @@ func (cfg *cloneConfig) setSourceDir() {
132132
os.MkdirAll(cfg.SourceDir, 0755)
133133
}
134134

135-
func (cfg *cloneConfig) setUrl() {
136-
if !isFullURL(cfg.Url) {
137-
cfg.Url = fmt.Sprintf("git@%s:%s/%s", cfg.Url, cfg.User, cfg.Repo)
135+
func (cfg *cloneConfig) setURL() {
136+
if !isFullURL(cfg.URL) {
137+
cfg.URL = fmt.Sprintf("git@%s:%s/%s", cfg.URL, cfg.User, cfg.Repo)
138138
}
139139
}
140140

@@ -146,9 +146,9 @@ func (cfg *cloneConfig) clone() {
146146
session := shell.Session()
147147
session.SetDir(cfg.SourceDir)
148148

149-
err := session.Command("git", "clone", cfg.Url).PrintOutput()
149+
err := session.Command("git", "clone", cfg.URL).PrintOutput()
150150
if err != nil {
151-
printer.Fail("Failed to clone %s", cfg.Url)
151+
printer.Fail("Failed to clone %s", cfg.URL)
152152
return
153153
}
154154
printer.Success("Clone was successful")

cmd/devctl.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,16 @@ var cfgFile string
1818

1919
var cmdWhitelist = [2]string{"update", "setup"}
2020

21+
// Version is the devctl version. Default is dev.
2122
var Version string
23+
24+
// BuildDate is the date this version is built. No default.
2225
var BuildDate string
2326

27+
// Verbose sets verbose printing mode.
2428
var Verbose bool
29+
30+
// DryRun set the dryrun flag. Disables distructive actions.
2531
var DryRun bool
2632

2733
var devctlHomeFolder string

cmd/generate.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ var gitignoreCmd = &cobra.Command{
8787
}
8888
defer resp.Body.Close()
8989

90-
gitignore := new(Gitignore)
90+
gitignore := new(gitignore)
9191
err = json.NewDecoder(resp.Body).Decode(gitignore)
9292
if utilities.HandleError(err) {
9393
return
@@ -123,7 +123,7 @@ func init() {
123123
generateCmd.AddCommand(gitignoreCmd)
124124
}
125125

126-
type Gitignore struct {
126+
type gitignore struct {
127127
Name *string `json:"name,omitempty"`
128128
Source *string `json:"source,omitempty"`
129129
}

0 commit comments

Comments
 (0)