diff --git a/cmd/glab/main.go b/cmd/glab/main.go index a57e0759..bed645a7 100644 --- a/cmd/glab/main.go +++ b/cmd/glab/main.go @@ -17,8 +17,10 @@ import ( // Version is set at build var version string + // build is set at build var build string + // usage mode is set at build to either "dev" or "prod" depending how binary is created var usageMode string var debug bool @@ -83,4 +85,4 @@ func printError(out io.Writer, err error, cmd *cobra.Command, debug bool) { } _, _ = fmt.Fprintln(out, cmd.UsageString()) } -} \ No newline at end of file +} diff --git a/cmd/glab/main_test.go b/cmd/glab/main_test.go index c7dc4e61..1f4b3491 100644 --- a/cmd/glab/main_test.go +++ b/cmd/glab/main_test.go @@ -19,7 +19,7 @@ import ( // and calls the main function func TestGlab(t *testing.T) { rand.Seed(time.Now().UnixNano()) - flag.Set("test", "../coverage-" + strconv.Itoa(int(rand.Uint64())) + ".out") + flag.Set("test", "../coverage-"+strconv.Itoa(int(rand.Uint64()))+".out") main() } @@ -49,12 +49,12 @@ func Test_printError(t *testing.T) { name: "DNS error", args: args{ err: fmt.Errorf("DNS oopsie: %w", &net.DNSError{ - Name: config.GetEnv("GITLAB_URI")+"/api/v4", + Name: config.GetEnv("GITLAB_URI") + "/api/v4", }), cmd: nil, debug: false, }, - wantOut: `error connecting to `+config.GetEnv("GITLAB_URI")+`/api/v4 + wantOut: `error connecting to ` + config.GetEnv("GITLAB_URI") + `/api/v4 check your internet connection or status.gitlab.com or 'Run sudo gitlab-ctl status' on your server if self-hosted `, }, @@ -87,4 +87,4 @@ check your internet connection or status.gitlab.com or 'Run sudo gitlab-ctl stat } }) } -} \ No newline at end of file +} diff --git a/commands/label_test.go b/commands/label_test.go index 92739c85..ddae0440 100644 --- a/commands/label_test.go +++ b/commands/label_test.go @@ -12,4 +12,4 @@ func TestLabelCmd(t *testing.T) { RootCmd.SetArgs(args) test.ShouldBeNil(RootCmd.Execute()) }) -} \ No newline at end of file +} diff --git a/commands/mr_checkout.go b/commands/mr_checkout.go index 9875c40b..006b2aad 100644 --- a/commands/mr_checkout.go +++ b/commands/mr_checkout.go @@ -80,4 +80,4 @@ func init() { mrCheckoutCmd.Flags().StringVarP(&mrCheckoutCfg.branch, "branch", "b", "", "checkout merge request with name") mrCheckoutCmd.Flags().BoolVarP(&mrCheckoutCfg.track, "track", "t", false, "set checked out branch to track mr author remote branch, adds remote if needed") mrCmd.AddCommand(mrCheckoutCmd) -} \ No newline at end of file +} diff --git a/commands/mr_create.go b/commands/mr_create.go index ea181a5b..21a0f5c2 100644 --- a/commands/mr_create.go +++ b/commands/mr_create.go @@ -33,7 +33,7 @@ var mrCreateCmd = &cobra.Command{ if source, _ := cmd.Flags().GetString("source-branch"); source != "" { sourceBranch = strings.Trim(source, "[] ") } else { - if c, _ := cmd.Flags().GetBool("create-source-branch"); c && sourceBranch=="" { + if c, _ := cmd.Flags().GetBool("create-source-branch"); c && sourceBranch == "" { sourceBranch = manip.ReplaceNonAlphaNumericChars(mergeTitle, "-") } else { b, err := git.CurrentBranch() @@ -79,13 +79,13 @@ var mrCreateCmd = &cobra.Command{ if t, _ := cmd.Flags().GetString("target-branch"); t != "" { targetBranch = strings.Trim(t, "[] ") } else { - targetBranch = manip.AskQuestionWithInput("Target Branch (Default is " + targetBranch + "):", targetBranch, false) + targetBranch = manip.AskQuestionWithInput("Target Branch (Default is "+targetBranch+"):", targetBranch, false) } isDraft, _ := cmd.Flags().GetBool("draft") isWIP, _ := cmd.Flags().GetBool("wip") if isDraft || isWIP { if isDraft { - mergeTitle = "Draft: "+mergeTitle + mergeTitle = "Draft: " + mergeTitle } else { mergeTitle = "WIP: " + mergeTitle } diff --git a/commands/mr_test.go b/commands/mr_test.go index 2a57a481..53390c8c 100644 --- a/commands/mr_test.go +++ b/commands/mr_test.go @@ -12,4 +12,4 @@ func TestMrCmd(t *testing.T) { RootCmd.SetArgs(args) RootCmd.Execute() }) -} \ No newline at end of file +} diff --git a/commands/project.go b/commands/project.go index 0f6bfcda..fc40846c 100644 --- a/commands/project.go +++ b/commands/project.go @@ -5,7 +5,7 @@ import ( "glab/internal/git" ) -func getProject(projectID interface{}) (*gitlab.Project, error) { +func getProject(projectID interface{}) (*gitlab.Project, error) { gitlabClient, _ := git.InitGitlabClient() opts := &gitlab.GetProjectOptions{ Statistics: gitlab.Bool(true), @@ -19,11 +19,11 @@ func getProject(projectID interface{}) (*gitlab.Project, error) { return project, nil } -func createProject(opts *gitlab.CreateProjectOptions) (*gitlab.Project, error) { +func createProject(opts *gitlab.CreateProjectOptions) (*gitlab.Project, error) { gitlabClient, _ := git.InitGitlabClient() project, _, err := gitlabClient.Projects.CreateProject(opts) if err != nil { return nil, err } return project, nil -} \ No newline at end of file +} diff --git a/commands/repo.go b/commands/repo.go index e8c9fd40..4f6b8696 100644 --- a/commands/repo.go +++ b/commands/repo.go @@ -35,9 +35,9 @@ func contains(arr []string, str string) bool { } var repoCmd = &cobra.Command{ - Use: "repo [flags]", - Short: `Work with GitLab repositories and projects`, - Long: ``, + Use: "repo [flags]", + Short: `Work with GitLab repositories and projects`, + Long: ``, Aliases: []string{"project"}, Run: func(cmd *cobra.Command, args []string) { if len(args) == 0 || len(args) > 2 { diff --git a/commands/user.go b/commands/user.go index b782dc65..76c31670 100644 --- a/commands/user.go +++ b/commands/user.go @@ -33,7 +33,7 @@ func getUsername(uid int) string { return u.Username } -func getUserActivities() ([]*gitlab.UserActivity, error) { +func getUserActivities() ([]*gitlab.UserActivity, error) { gLab, _ := git.InitGitlabClient() l := &gitlab.GetUserActivitiesOptions{} ua, _, err := gLab.Users.GetUserActivities(l) @@ -41,4 +41,4 @@ func getUserActivities() ([]*gitlab.UserActivity, error) { return nil, err } return ua, nil -} \ No newline at end of file +} diff --git a/commands/version_test.go b/commands/version_test.go index 176632e7..56143d68 100644 --- a/commands/version_test.go +++ b/commands/version_test.go @@ -12,4 +12,4 @@ func TestVersionCmd(t *testing.T) { RootCmd.SetArgs(args) test.ShouldBeNil(RootCmd.Execute()) }) -} \ No newline at end of file +} diff --git a/internal/git/git_test.go b/internal/git/git_test.go index bcbc4d64..c69ab29c 100644 --- a/internal/git/git_test.go +++ b/internal/git/git_test.go @@ -29,4 +29,4 @@ func Test_isFilesystemPath(t *testing.T) { } }) } -} \ No newline at end of file +} diff --git a/internal/utils/errors.go b/internal/utils/errors.go index 72a1f700..58129834 100644 --- a/internal/utils/errors.go +++ b/internal/utils/errors.go @@ -16,4 +16,4 @@ func (fe FlagError) Unwrap() error { } // SilentError is an error that triggers exit code 1 without any error messaging -var SilentError = errors.New("SilentError") \ No newline at end of file +var SilentError = errors.New("SilentError")