Skip to content
This repository has been archived by the owner on Nov 22, 2022. It is now read-only.

Commit

Permalink
Format code with Go fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
deepsource-autofix[bot] authored Aug 15, 2020
1 parent a916922 commit c838226
Show file tree
Hide file tree
Showing 12 changed files with 24 additions and 22 deletions.
4 changes: 3 additions & 1 deletion cmd/glab/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -83,4 +85,4 @@ func printError(out io.Writer, err error, cmd *cobra.Command, debug bool) {
}
_, _ = fmt.Fprintln(out, cmd.UsageString())
}
}
}
8 changes: 4 additions & 4 deletions cmd/glab/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}

Expand Down Expand Up @@ -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
`,
},
Expand Down Expand Up @@ -87,4 +87,4 @@ check your internet connection or status.gitlab.com or 'Run sudo gitlab-ctl stat
}
})
}
}
}
2 changes: 1 addition & 1 deletion commands/label_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ func TestLabelCmd(t *testing.T) {
RootCmd.SetArgs(args)
test.ShouldBeNil(RootCmd.Execute())
})
}
}
2 changes: 1 addition & 1 deletion commands/mr_checkout.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,4 @@ func init() {
mrCheckoutCmd.Flags().StringVarP(&mrCheckoutCfg.branch, "branch", "b", "", "checkout merge request with <branch> 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)
}
}
6 changes: 3 additions & 3 deletions commands/mr_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion commands/mr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ func TestMrCmd(t *testing.T) {
RootCmd.SetArgs(args)
RootCmd.Execute()
})
}
}
6 changes: 3 additions & 3 deletions commands/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -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
}
}
6 changes: 3 additions & 3 deletions commands/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ func contains(arr []string, str string) bool {
}

var repoCmd = &cobra.Command{
Use: "repo <command> [flags]",
Short: `Work with GitLab repositories and projects`,
Long: ``,
Use: "repo <command> [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 {
Expand Down
4 changes: 2 additions & 2 deletions commands/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ 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)
if err != nil {
return nil, err
}
return ua, nil
}
}
2 changes: 1 addition & 1 deletion commands/version_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ func TestVersionCmd(t *testing.T) {
RootCmd.SetArgs(args)
test.ShouldBeNil(RootCmd.Execute())
})
}
}
2 changes: 1 addition & 1 deletion internal/git/git_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ func Test_isFilesystemPath(t *testing.T) {
}
})
}
}
}
2 changes: 1 addition & 1 deletion internal/utils/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
var SilentError = errors.New("SilentError")

0 comments on commit c838226

Please sign in to comment.