From eadd73c654295d483863ea76362bb9b936d190ee Mon Sep 17 00:00:00 2001 From: Eriks Zelenka Date: Sat, 7 Dec 2024 10:15:38 +0000 Subject: [PATCH 01/20] fix: add reviewdog pipeline --- .github/workflows/reviewdog.yaml | 33 ++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .github/workflows/reviewdog.yaml diff --git a/.github/workflows/reviewdog.yaml b/.github/workflows/reviewdog.yaml new file mode 100644 index 0000000..9f782d9 --- /dev/null +++ b/.github/workflows/reviewdog.yaml @@ -0,0 +1,33 @@ +name: reviewdog +on: [pull_request] + +jobs: + reviewdog: + name: linters + runs-on: ubuntu-latest + steps: + # UPDATE_HERE + # https://github.com/actions/checkout/releases + - name: check out code into the go module directory + uses: actions/checkout@v4 + + # UPDATE_HERE + # https://github.com/webfactory/ssh-agent/releases + - name: Configure SSH private key for private repos + uses: webfactory/ssh-agent@v0.9.0 + with: + # AWS secret: storm/deploy-ssh-keys + ssh-private-key: | + ${{ secrets.SSH_KEY }} + + # UPDATE_HERE + # https://github.com/reviewdog/action-golangci-lint/releases + - name: golangci-lint + uses: reviewdog/action-golangci-lint@v2 + with: + golangci_lint_flags: "--timeout=4m" + + # UPDATE_HERE + # https://github.com/reviewdog/action-actionlint/releases + - name: action-lint + uses: reviewdog/action-actionlint@v1 From 07af7cfed5528b506912e248f51347b5879bb533 Mon Sep 17 00:00:00 2001 From: Eriks Zelenka Date: Sat, 7 Dec 2024 17:53:44 +0000 Subject: [PATCH 02/20] Fix typo --- .github/workflows/reviewdog.yaml | 17 +++--- .golangci.yml | 98 ++++++++++++++++++++++++++++++++ 2 files changed, 106 insertions(+), 9 deletions(-) create mode 100644 .golangci.yml diff --git a/.github/workflows/reviewdog.yaml b/.github/workflows/reviewdog.yaml index 9f782d9..2ca6314 100644 --- a/.github/workflows/reviewdog.yaml +++ b/.github/workflows/reviewdog.yaml @@ -11,23 +11,22 @@ jobs: - name: check out code into the go module directory uses: actions/checkout@v4 - # UPDATE_HERE - # https://github.com/webfactory/ssh-agent/releases - - name: Configure SSH private key for private repos - uses: webfactory/ssh-agent@v0.9.0 - with: - # AWS secret: storm/deploy-ssh-keys - ssh-private-key: | - ${{ secrets.SSH_KEY }} # UPDATE_HERE # https://github.com/reviewdog/action-golangci-lint/releases - name: golangci-lint uses: reviewdog/action-golangci-lint@v2 with: - golangci_lint_flags: "--timeout=4m" + golangci_lint_flags: "--timeout=15m" # UPDATE_HERE # https://github.com/reviewdog/action-actionlint/releases - name: action-lint uses: reviewdog/action-actionlint@v1 + + # UPDATE_HERE + # https://github.com/reviewdog/action-hadolint/releases + - name: docker-hadolint + uses: reviewdog/action-hadolint@v1 + with: + hadolint_flags: --trusted-registry docker.io diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 0000000..8d23288 --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,98 @@ +--- +run: + concurrency: 6 + deadline: 5m +issues: + exclude-rules: + # counterfeiter fakes are usually named 'fake_.go' + - path: fake_.*\.go + linters: + - gocritic + - golint + - dupl +linters: + # please, do not use `enable-all`: it's deprecated and will be removed soon. + # inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint + disable-all: true + + enable: + - asciicheck + - bodyclose + - errcheck + - exportloopref + - goconst + - gocritic + - gofmt + - gofumpt + - goimports + - gosec + - gosimple + - govet + - ineffassign + - misspell + - nakedret + - nolintlint + - prealloc + - unconvert + - unconvert + - whitespace + - unused + - ineffassign + # - unparam + # - revive + # - stylecheck + # - lll + # - gomnd + # - goprintffuncname + # - interfacer + # - staticcheck + # - structcheck + # - typecheck + # - goerr113 + # - noctx + +linters-settings: + gosec: + excludes: + - G402 + gocritic: + enabled-checks: + # Diagnostic + - commentedOutCode + - nilValReturn + - sloppyReassign + - weakCond + - octalLiteral + + # Performance + - appendCombine + - equalFold + - hugeParam + - indexAlloc + - rangeExprCopy + # - rangeValCopy + + # Style + - boolExprSimplify + - commentedOutImport + - docStub + - emptyFallthrough + - emptyStringTest + - hexLiteral + - methodExprCall + - stringXbytes + - typeAssertChain + - unlabelStmt + - yodaStyleExpr + # - ifElseChain + + # Opinionated + - builtinShadow + - importShadow + - initClause + - nestingReduce + - paramTypeCombine + - ptrToRefParam + - typeUnparen + - unnamedResult + - unnecessaryBlock From 6298beed8b0927535bf2b28e24c07ac528e03989 Mon Sep 17 00:00:00 2001 From: Eriks Zelenka Date: Sat, 7 Dec 2024 18:13:08 +0000 Subject: [PATCH 03/20] Fix typo --- .github/workflows/reviewdog.yaml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.github/workflows/reviewdog.yaml b/.github/workflows/reviewdog.yaml index 2ca6314..59aa656 100644 --- a/.github/workflows/reviewdog.yaml +++ b/.github/workflows/reviewdog.yaml @@ -23,10 +23,3 @@ jobs: # https://github.com/reviewdog/action-actionlint/releases - name: action-lint uses: reviewdog/action-actionlint@v1 - - # UPDATE_HERE - # https://github.com/reviewdog/action-hadolint/releases - - name: docker-hadolint - uses: reviewdog/action-hadolint@v1 - with: - hadolint_flags: --trusted-registry docker.io From 186c6e8e74c30e512c44b6a52806da3b502f0f3a Mon Sep 17 00:00:00 2001 From: Eriks Zelenka Date: Sat, 7 Dec 2024 18:29:25 +0000 Subject: [PATCH 04/20] Fix typo --- cmd/version.go | 5 ++--- gitget/get.go | 51 +++++++++++++++++++++++++++++--------------------- 2 files changed, 32 insertions(+), 24 deletions(-) diff --git a/cmd/version.go b/cmd/version.go index 3129424..7f50835 100644 --- a/cmd/version.go +++ b/cmd/version.go @@ -38,10 +38,9 @@ var versionCmd = &cobra.Command{ Use: "version", Short: "Prints version information", Run: func(cmd *cobra.Command, args []string) { + printLongVersion, _ := cmd.Flags().GetBool("long") - long, _ := cmd.Flags().GetBool("long") - - if long == true { + if printLongVersion { fmt.Printf( "%s %s %s %s %s/%s\n", filepath.Base(os.Args[0]), diff --git a/gitget/get.go b/gitget/get.go index 6b92235..b39896c 100644 --- a/gitget/get.go +++ b/gitget/get.go @@ -49,14 +49,16 @@ import ( "github.com/isindir/git-get/gitlab" ) -var stayOnRef bool -var defaultMainBranch = "master" -var gitProvider string -var mirrorVisibilityMode = "private" -var bitbucketMirrorProject = "" -var colorHighlight *color.Color -var colorRef *color.Color -var shellRunner = new(exec.ShellRunner) +var ( + stayOnRef bool + defaultMainBranch = "master" + gitProvider string + mirrorVisibilityMode = "private" + bitbucketMirrorProject = "" + colorHighlight *color.Color + colorRef *color.Color + shellRunner = new(exec.ShellRunner) +) // ConfigGenParamsStruct - data structure to store parameters passed via cli flags type ConfigGenParamsStruct struct { @@ -526,22 +528,29 @@ func (repo *Repo) CreateSymlink(symlink string) { } // check if directory of symlink exists - symnlinkDir := filepath.Dir(symlink) - exists, finfo := PathExists(symnlinkDir) + symlinkDir := filepath.Dir(symlink) + exists, fileInfo := PathExists(symlinkDir) if exists { // create symlink in directory if it does exist - if finfo.IsDir() { - os.Symlink(repo.fullPath, symlink) + if fileInfo.IsDir() { + err := os.Symlink(repo.fullPath, symlink) + if err != nil { + log.Fatalln(err) + os.Exit(1) + } } else { errorMessage := fmt.Sprintf( "%s: path for symlink '%s' directory '%s' exists, but is not directory - check configuration", - repo.sha, symlink, symnlinkDir) + repo.sha, + symlink, + symlinkDir, + ) repo.status.Error = true log.Error(errorMessage) } } else { // Otherwise ensure directory and create symlink - err := os.MkdirAll(symnlinkDir, os.ModePerm) + err := os.MkdirAll(symlinkDir, os.ModePerm) if err != nil { log.Fatalln(err) os.Exit(1) @@ -671,7 +680,7 @@ func (repo *Repo) EnsureBitbucketMirrorExists() { } func getShallowReposFromConfigInParallel(repoList *RepoList, ignoreRepoList []Repo, concurrencyLevel int) { - var throttle = make(chan int, concurrencyLevel) + throttle := make(chan int, concurrencyLevel) var wait sync.WaitGroup @@ -705,7 +714,7 @@ func getShallowReposFromConfigInParallel(repoList *RepoList, ignoreRepoList []Re } func getReposFromConfigInParallel(repoList *RepoList, ignoreRepoList []Repo, concurrencyLevel int) { - var throttle = make(chan int, concurrencyLevel) + throttle := make(chan int, concurrencyLevel) var wait sync.WaitGroup @@ -746,7 +755,7 @@ func mirrorReposFromConfigInParallel( pushMirror bool, mirrorRootURL string, ) { - var throttle = make(chan int, concurrencyLevel) + throttle := make(chan int, concurrencyLevel) var wait sync.WaitGroup @@ -907,7 +916,7 @@ func getBitbucketRepositoryGitURL( v map[string]interface{}, gitCloudProviderRootURL string, fullName string, - GitSchema string, + gitSchema string, ) string { var bbLinks []bitbucketLinks cloneLinks := v["clone"] @@ -930,10 +939,10 @@ func getBitbucketRepositoryGitURL( for j := 0; j < len(bbLinks); j++ { log.Debugf("%+v", bbLinks[j]) - if (bbLinks[j].Name == "ssh") && (GitSchema == "ssh") { + if (bbLinks[j].Name == "ssh") && (gitSchema == "ssh") { return bbLinks[j].HREF } - if (bbLinks[j].Name == "https") && (GitSchema == "https") { + if (bbLinks[j].Name == "https") && (gitSchema == "https") { return bbLinks[j].HREF } } @@ -1050,7 +1059,7 @@ func writeReposToFile(repoSha string, cfgFile string, repoList []Repo) { } log.Infof("%s: Writing file '%s'", repoSha, cfgFile) - err = ioutil.WriteFile(cfgFile, repoData, 0644) + err = ioutil.WriteFile(cfgFile, repoData, 0o644) if err != nil { log.Fatalf("%s: %s", cfgFile, err) } From bb4a6947a189caa133e21f6c3b01f8c3dfaa134a Mon Sep 17 00:00:00 2001 From: Eriks Zelenka Date: Sat, 7 Dec 2024 18:31:56 +0000 Subject: [PATCH 05/20] Fix typo --- gitget/get.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gitget/get.go b/gitget/get.go index b39896c..5df6ad2 100644 --- a/gitget/get.go +++ b/gitget/get.go @@ -1059,7 +1059,7 @@ func writeReposToFile(repoSha string, cfgFile string, repoList []Repo) { } log.Infof("%s: Writing file '%s'", repoSha, cfgFile) - err = ioutil.WriteFile(cfgFile, repoData, 0o644) + err = os.WriteFile(cfgFile, repoData, 0o644) if err != nil { log.Fatalf("%s: %s", cfgFile, err) } From e5e41b5f7cd16451bd659994d3f187006876f171 Mon Sep 17 00:00:00 2001 From: Eriks Zelenka Date: Sat, 7 Dec 2024 18:44:08 +0000 Subject: [PATCH 06/20] Fix typo --- gitget/get.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gitget/get.go b/gitget/get.go index 5df6ad2..69bfe7a 100644 --- a/gitget/get.go +++ b/gitget/get.go @@ -1059,7 +1059,7 @@ func writeReposToFile(repoSha string, cfgFile string, repoList []Repo) { } log.Infof("%s: Writing file '%s'", repoSha, cfgFile) - err = os.WriteFile(cfgFile, repoData, 0o644) + err = os.WriteFile(cfgFile, repoData, 0o600) if err != nil { log.Fatalf("%s: %s", cfgFile, err) } From d0b602e1768c62951f00b930801ade903aef9d33 Mon Sep 17 00:00:00 2001 From: Eriks Zelenka Date: Sat, 7 Dec 2024 18:53:08 +0000 Subject: [PATCH 07/20] Fix typo --- gitget/get.go | 57 +++++++++++++++++++++++++++++++++++++++--------- gitlab/gitlab.go | 14 ++++++------ 2 files changed, 54 insertions(+), 17 deletions(-) diff --git a/gitget/get.go b/gitget/get.go index 69bfe7a..828c120 100644 --- a/gitget/get.go +++ b/gitget/get.go @@ -306,7 +306,12 @@ func (repo *Repo) CloneMirror() bool { func (repo *Repo) PushMirror() bool { log.Infof("%s: Push repository '%s' as a mirror '%s'", repo.sha, repo.URL, repo.mirrorURL) var serr bytes.Buffer - _, err := (*repo.executor).ExecGitCommand([]string{"push", "--mirror", repo.mirrorURL}, nil, &serr, repo.fullPath) + _, err := (*repo.executor).ExecGitCommand( + []string{"push", "--mirror", repo.mirrorURL}, + nil, + &serr, + repo.fullPath, + ) if err != nil { log.Errorf("%s: %v %v", repo.sha, err, serr.String()) return false @@ -378,7 +383,12 @@ func (repo *Repo) IsClean() bool { func (repo *Repo) IsCurrentBranchRef() bool { var outb, errb bytes.Buffer - _, err := (*repo.executor).ExecGitCommand([]string{"rev-parse", "--abbrev-ref", "HEAD"}, &outb, &errb, repo.fullPath) + _, err := (*repo.executor).ExecGitCommand( + []string{"rev-parse", "--abbrev-ref", "HEAD"}, + &outb, + &errb, + repo.fullPath, + ) if err != nil { log.Errorf("%s: Error when checking branch %v", repo.sha, err) } @@ -387,7 +397,12 @@ func (repo *Repo) IsCurrentBranchRef() bool { func (repo *Repo) GetCurrentBranch() string { var outb, errb bytes.Buffer - _, err := (*repo.executor).ExecGitCommand([]string{"rev-parse", "--abbrev-ref", "HEAD"}, &outb, &errb, repo.fullPath) + _, err := (*repo.executor).ExecGitCommand( + []string{"rev-parse", "--abbrev-ref", "HEAD"}, + &outb, + &errb, + repo.fullPath, + ) if err != nil { log.Errorf("%s: Error when getting branch %v", repo.sha, err) return "" @@ -555,7 +570,11 @@ func (repo *Repo) CreateSymlink(symlink string) { log.Fatalln(err) os.Exit(1) } - os.Symlink(repo.fullPath, symlink) + err = os.Symlink(repo.fullPath, symlink) + if err != nil { + log.Fatalln(err) + os.Exit(1) + } } } @@ -864,7 +883,7 @@ func fetchGithubRepos( ignoreRepoList []Repo, gitCloudProviderRootURL string, targetClonePath string, - configGenParams ConfigGenParamsStruct, + configGenParams *ConfigGenParamsStruct, ) []Repo { var repoList []Repo ctx := context.Background() @@ -956,7 +975,7 @@ func fetchBitbucketRepos( ignoreRepoList []Repo, gitCloudProviderRootURL string, targetClonePath string, - configGenParams ConfigGenParamsStruct, + configGenParams *ConfigGenParamsStruct, ) []Repo { var repoList []Repo @@ -993,7 +1012,7 @@ func fetchGitlabRepos( ignoreRepoList []Repo, gitCloudProviderRootURL string, targetClonePath string, - configGenParams ConfigGenParamsStruct, + configGenParams *ConfigGenParamsStruct, ) []Repo { var repoList []Repo @@ -1137,11 +1156,29 @@ func GenerateGitfileConfig( switch gitCloudProvider { case "github": - repoList = fetchGithubRepos(repoSha, ignoreRepoList, gitCloudProviderRootURL, targetClonePath, configGenParams) + repoList = fetchGithubRepos( + repoSha, + ignoreRepoList, + gitCloudProviderRootURL, + targetClonePath, + &configGenParams, + ) case "gitlab": - repoList = fetchGitlabRepos(repoSha, ignoreRepoList, gitCloudProviderRootURL, targetClonePath, configGenParams) + repoList = fetchGitlabRepos( + repoSha, + ignoreRepoList, + gitCloudProviderRootURL, + targetClonePath, + &configGenParams, + ) case "bitbucket": - repoList = fetchBitbucketRepos(repoSha, ignoreRepoList, gitCloudProviderRootURL, targetClonePath, configGenParams) + repoList = fetchBitbucketRepos( + repoSha, + ignoreRepoList, + gitCloudProviderRootURL, + targetClonePath, + &configGenParams, + ) default: log.Fatalf("%s: Error: unknown '%s' git mirror provider", repoSha, gitCloudProvider) os.Exit(1) diff --git a/gitlab/gitlab.go b/gitlab/gitlab.go index 8a18c1d..de71f15 100644 --- a/gitlab/gitlab.go +++ b/gitlab/gitlab.go @@ -114,15 +114,15 @@ func (gitProvider *GitGetGitlab) ProjectExists(repositorySha string, baseUrl str log.Debugf("%s: project: '%+v'", repositorySha, prj) - if err != nil { - return false - } - - return true + return err == nil } // GetProjectNamespace - return Project Namespace and namespace full path -func (gitProvider *GitGetGitlab) GetProjectNamespace(repositorySha string, baseUrl string, projectNameFullPath string) (*gitlab.Namespace, string) { +func (gitProvider *GitGetGitlab) GetProjectNamespace( + repositorySha string, + baseUrl string, + projectNameFullPath string, +) (*gitlab.Namespace, string) { log.Debugf("%s: Getting Project FullPath Namespace '%s'", repositorySha, projectNameFullPath) gitProvider.auth(repositorySha, baseUrl) @@ -181,7 +181,7 @@ func (gitProvider *GitGetGitlab) CreateProject( func (gitProvider *GitGetGitlab) getGroupID(repoSha string, git *gitlab.Client, groupName string) (int, string, error) { // Fetch group ID needed for other operations _, shortName := filepath.Split(groupName) - //escapedGroupName := url.QueryEscape(groupName) + // escapedGroupName := url.QueryEscape(groupName) escapedGroupName := url.QueryEscape(shortName) foundGroups, _, err := git.Groups.SearchGroup(escapedGroupName) From 3d36fdedaa86d4f058e1074f0a9156eee8c83d2a Mon Sep 17 00:00:00 2001 From: Eriks Zelenka Date: Sat, 7 Dec 2024 19:04:53 +0000 Subject: [PATCH 08/20] Fix typo --- gitlab/gitlab.go | 79 +++++++++++++++++++++++++++++++++++++----------- 1 file changed, 62 insertions(+), 17 deletions(-) diff --git a/gitlab/gitlab.go b/gitlab/gitlab.go index de71f15..b5d2e26 100644 --- a/gitlab/gitlab.go +++ b/gitlab/gitlab.go @@ -41,10 +41,25 @@ type GitGetGitlab struct { type GitGetGitlabI interface { Init() bool - gitlabAuth(repositorySha string, baseUrl string) bool - ProjectExists(repositorySha string, baseUrl string, projectName string) bool - GetProjectNamespace(repositorySha string, baseUrl string, projectNameFullPath string) (*gitlab.Namespace, string) - getGroupID(repoSha string, git *gitlab.Client, groupName string) (int, string, error) + gitlabAuth( + repositorySha string, + baseUrl string, + ) bool + ProjectExists( + repositorySha string, + baseUrl string, + projectName string, + ) bool + GetProjectNamespace( + repositorySha string, + baseUrl string, + projectNameFullPath string, + ) (*gitlab.Namespace, string) + getGroupID( + repoSha string, + git *gitlab.Client, + groupName string, + ) (int, string, error) CreateProject( repositorySha string, @@ -146,6 +161,22 @@ func (gitProvider *GitGetGitlab) GetProjectNamespace( return namespaceObject, namespaceFullPath } +func boolPtr(value bool) *bool { + return &value +} + +func stringPtr(value string) *string { + return &value +} + +func intPtr(value int) *int { + return &value +} + +func gitlabVisibilityValuePtr(value gitlab.VisibilityValue) *gitlab.VisibilityValue { + return &value +} + // CreateProject - Create new code repository func (gitProvider *GitGetGitlab) CreateProject( repositorySha string, @@ -158,27 +189,38 @@ func (gitProvider *GitGetGitlab) CreateProject( gitProvider.auth(repositorySha, baseUrl) p := &gitlab.CreateProjectOptions{ - Name: gitlab.String(projectName), - Description: gitlab.String(fmt.Sprintf("Mirror of the '%s'", sourceURL)), - MergeRequestsEnabled: gitlab.Bool(true), - Visibility: gitlab.Visibility(gitlab.VisibilityValue(mirrorVisibilityMode)), + Name: stringPtr(projectName), + Description: stringPtr( + fmt.Sprintf("Mirror of the '%s'", sourceURL), + ), + MergeRequestsEnabled: boolPtr(true), + Visibility: gitlabVisibilityValuePtr( + gitlab.VisibilityValue(mirrorVisibilityMode), + ), } if namespaceID != 0 { - p.NamespaceID = gitlab.Int(namespaceID) + p.NamespaceID = intPtr(namespaceID) } project, _, err := gitProvider.client.Projects.CreateProject(p) if err != nil { log.Fatalf( "%s: Error - while trying to create gitlab project '%s': '%s'", - repositorySha, projectName, err) + repositorySha, + projectName, + err, + ) os.Exit(1) } return project } -func (gitProvider *GitGetGitlab) getGroupID(repoSha string, git *gitlab.Client, groupName string) (int, string, error) { +func (gitProvider *GitGetGitlab) getGroupID( + repoSha string, + git *gitlab.Client, + groupName string, +) (int, string, error) { // Fetch group ID needed for other operations _, shortName := filepath.Split(groupName) // escapedGroupName := url.QueryEscape(groupName) @@ -192,7 +234,10 @@ func (gitProvider *GitGetGitlab) getGroupID(repoSha string, git *gitlab.Client, for group := 0; group < len(foundGroups); group++ { log.Debugf( "%s: Checking group '%d:%s' to be as specified", - repoSha, foundGroups[group].ID, foundGroups[group].FullName) + repoSha, + foundGroups[group].ID, + foundGroups[group].FullName, + ) if groupName == strings.Replace(foundGroups[group].FullName, " ", "", -1) { return foundGroups[group].ID, foundGroups[group].FullName, nil } @@ -220,9 +265,9 @@ func (gitProvider *GitGetGitlab) processSubgroups( subGrpOpt := &gitlab.ListSubGroupsOptions{ ListOptions: lstOpts, - AllAvailable: gitlab.Bool(true), - TopLevelOnly: gitlab.Bool(false), - Owned: gitlab.Bool(gitlabOwned), + AllAvailable: boolPtr(true), + TopLevelOnly: boolPtr(false), + Owned: boolPtr(gitlabOwned), } switch gitlabMinAccessLevel { case "min": @@ -319,8 +364,8 @@ func (gitProvider *GitGetGitlab) appendGroupsProjects( // https://docs.gitlab.com/ee/api/groups.html#list-a-groups-projects prjOpt := &gitlab.ListGroupProjectsOptions{ ListOptions: lstOpts, - Owned: gitlab.Bool(gitlabOwned), - Simple: gitlab.Bool(true), + Owned: boolPtr(gitlabOwned), + Simple: boolPtr(true), } switch gitlabVisibility { case "private": From e50ac254404032b591722fbad48686c798f722bd Mon Sep 17 00:00:00 2001 From: Eriks Zelenka Date: Sat, 7 Dec 2024 19:14:20 +0000 Subject: [PATCH 09/20] Fix typo --- gitlab/gitlab.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/gitlab/gitlab.go b/gitlab/gitlab.go index b5d2e26..f49ae3b 100644 --- a/gitlab/gitlab.go +++ b/gitlab/gitlab.go @@ -137,7 +137,7 @@ func (gitProvider *GitGetGitlab) GetProjectNamespace( repositorySha string, baseUrl string, projectNameFullPath string, -) (*gitlab.Namespace, string) { +) (namespaceObject *gitlab.Namespace, namespaceFullPath string) { log.Debugf("%s: Getting Project FullPath Namespace '%s'", repositorySha, projectNameFullPath) gitProvider.auth(repositorySha, baseUrl) @@ -146,7 +146,7 @@ func (gitProvider *GitGetGitlab) GetProjectNamespace( if len(pathElements) > 0 { pathElements = pathElements[:len(pathElements)-1] } - namespaceFullPath := strings.Join(pathElements, "/") + namespaceFullPath = strings.Join(pathElements, "/") namespaceObject, _, err := gitProvider.client.Namespaces.GetNamespace(namespaceFullPath, nil, nil) @@ -220,10 +220,9 @@ func (gitProvider *GitGetGitlab) getGroupID( repoSha string, git *gitlab.Client, groupName string, -) (int, string, error) { +) (foundGroupId int, foundGroupFullName string, err error) { // Fetch group ID needed for other operations _, shortName := filepath.Split(groupName) - // escapedGroupName := url.QueryEscape(groupName) escapedGroupName := url.QueryEscape(shortName) foundGroups, _, err := git.Groups.SearchGroup(escapedGroupName) From 638821ac4a23e03b5f4b1bf2a33094eb9244af64 Mon Sep 17 00:00:00 2001 From: Eriks Zelenka Date: Sat, 7 Dec 2024 19:20:58 +0000 Subject: [PATCH 10/20] Fix typo --- gitget/get.go | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/gitget/get.go b/gitget/get.go index 828c120..675df57 100644 --- a/gitget/get.go +++ b/gitget/get.go @@ -232,7 +232,7 @@ func (repo *Repo) PrepareForGet() { repo.SetRepoFullPath() repo.SetSha() - log.Infof("%s: url: %s (%s) -> %s", repo.sha, repo.URL, colorRef.Sprintf(repo.Ref), repo.fullPath) + log.Infof("%s: url: %s (%s) -> %s", repo.sha, repo.URL, colorRef.Sprintf("%s", repo.Ref), repo.fullPath) log.Debugf("%s: Repository structure: '%+v'", repo.sha, repo) } @@ -246,7 +246,7 @@ func (repo *Repo) PrepareForMirror(pathPrefix string, mirrorRootURL string) { repo.SetRepoFullPath() repo.SetSha() - log.Infof("%s: url: %s (%s) -> %s", repo.sha, repo.URL, colorRef.Sprintf(repo.Ref), repo.fullPath) + log.Infof("%s: url: %s (%s) -> %s", repo.sha, repo.URL, colorRef.Sprintf("%s", repo.Ref), repo.fullPath) log.Debugf("%s: Repository structure: '%+v'", repo.sha, repo) } @@ -375,10 +375,7 @@ func (repo *Repo) IsClean() bool { return false } _, err = (*repo.executor).ExecGitCommand([]string{"diff", "--staged", "--quiet"}, nil, nil, repo.fullPath) - if err != nil { - return false - } - return true + return err == nil } func (repo *Repo) IsCurrentBranchRef() bool { @@ -443,10 +440,7 @@ func (repo *Repo) IsRefBranch() bool { nil, repo.fullPath, ) - if err != nil { - return false - } - return true + return err == nil } func (repo *Repo) IsRefTag() bool { @@ -457,10 +451,7 @@ func (repo *Repo) IsRefTag() bool { nil, repo.fullPath, ) - if err != nil { - return false - } - return true + return err == nil } func (repo *Repo) GitPull() { @@ -496,7 +487,7 @@ func (repo *Repo) ProcessRepoBasedOnCleaness() { } func (repo *Repo) GitCheckout(branch string) bool { - log.Infof("%s: Checkout to '%s' branch in '%s'", repo.sha, colorHighlight.Sprintf(branch), repo.fullPath) + log.Infof("%s: Checkout to '%s' branch in '%s'", repo.sha, colorHighlight.Sprintf("%s", branch), repo.fullPath) var serr bytes.Buffer res := true From dcc1b9270d875ebb18500180e56ec6dd94444fe5 Mon Sep 17 00:00:00 2001 From: Eriks Zelenka Date: Sat, 7 Dec 2024 19:22:19 +0000 Subject: [PATCH 11/20] Fix typo --- gitget/get_test.go | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/gitget/get_test.go b/gitget/get_test.go index a15880a..2eab975 100644 --- a/gitget/get_test.go +++ b/gitget/get_test.go @@ -35,7 +35,6 @@ func Test_SetDefaultRef(t *testing.T) { } func Test_GetRepoLocalName(t *testing.T) { - // Test extracting altname from git repo name, if altname is not specified var altname string for repoURL, expectedAltName := range repoUrls { @@ -52,7 +51,6 @@ func Test_GetRepoLocalName(t *testing.T) { } func Test_SetRepoLocalName(t *testing.T) { - for repoURL, expectedAltName := range repoUrls { repo := Repo{} repo.URL = repoURL @@ -368,14 +366,22 @@ func Test_Repo_IsClean(t *testing.T) { } testCases := []testCase{ - {name: "test 1: no error", expectedResult: true, - repo: Repo{fullPath: "cde_p"}, err1: nil, err2: nil}, - {name: "test 2: err1 raised", expectedResult: false, - repo: Repo{fullPath: "cde_a"}, err1: fmt.Errorf("test error"), err2: nil}, - {name: "test 3: err2 raised", expectedResult: false, - repo: Repo{fullPath: "cde_a"}, err1: nil, err2: fmt.Errorf("test error")}, - {name: "test 3: err1 and err2 can be raised", expectedResult: false, - repo: Repo{fullPath: "cde_a"}, err1: fmt.Errorf("test error"), err2: fmt.Errorf("test error")}, + { + name: "test 1: no error", expectedResult: true, + repo: Repo{fullPath: "cde_p"}, err1: nil, err2: nil, + }, + { + name: "test 2: err1 raised", expectedResult: false, + repo: Repo{fullPath: "cde_a"}, err1: fmt.Errorf("test error"), err2: nil, + }, + { + name: "test 3: err2 raised", expectedResult: false, + repo: Repo{fullPath: "cde_a"}, err1: nil, err2: fmt.Errorf("test error"), + }, + { + name: "test 3: err1 and err2 can be raised", expectedResult: false, + repo: Repo{fullPath: "cde_a"}, err1: fmt.Errorf("test error"), err2: fmt.Errorf("test error"), + }, } for _, tc := range testCases { From afc9ee56d44c3b152f115668142cbf6cb8e91e2d Mon Sep 17 00:00:00 2001 From: Eriks Zelenka Date: Sat, 7 Dec 2024 19:25:16 +0000 Subject: [PATCH 12/20] Fix typo --- bitbucket/bitbucket.go | 4 ---- gitlab/gitlab.go | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/bitbucket/bitbucket.go b/bitbucket/bitbucket.go index c764c2c..c7d1175 100644 --- a/bitbucket/bitbucket.go +++ b/bitbucket/bitbucket.go @@ -66,7 +66,6 @@ func RepositoryExists(repoSha string, owner string, repository string) bool { RepoSlug: repository, } repo, err := git.Repositories.Repository.Get(repoOptions) - if err != nil { log.Debugf("%s: Error fetching repository '%s/%s': %+v", repoSha, owner, repository, err) return false @@ -85,7 +84,6 @@ func ProjectExists(git *bitbucket.Client, repoSha string, workspace string, proj log.Debugf("%s: Parameter ProjectOptions '%+v'", repoSha, opt) prj, err := git.Workspaces.GetProject(opt) - if err != nil { log.Debugf("%s: Error fetching project '%s' in workspace '%s': %+v\n", repoSha, project, workspace, err) return false @@ -125,7 +123,6 @@ func CreateRepository(repoSha, repository, mirrorVisibilityMode, sourceURL, proj log.Debugf("%s: Creating repository with parameters: '%+v'", repoSha, repoOptions) resultingRepository, err := git.Repositories.Repository.Create(repoOptions) - if err != nil { log.Fatalf("%s: Error - while trying to create github repository '%s': '%s'", repoSha, repository, err) os.Exit(1) @@ -156,7 +153,6 @@ func FetchOwnerRepos(repoSha, owner, bitbucketRole string) []bitbucket.Repositor reposToReutrn = repos.Items } else { log.Errorf("%s: Can't fetch repository list for '%s' '%+v'", repoSha, owner, err) - } for i := 0; repos != nil && i < len(repos.Items) && err == nil; i++ { diff --git a/gitlab/gitlab.go b/gitlab/gitlab.go index f49ae3b..cdcc38f 100644 --- a/gitlab/gitlab.go +++ b/gitlab/gitlab.go @@ -108,7 +108,7 @@ func (gitProvider *GitGetGitlab) Init() bool { return tokenFound } -func (gitProvider *GitGetGitlab) auth(repositorySha string, baseUrl string) bool { +func (gitProvider *GitGetGitlab) auth(repositorySha, baseUrl string) bool { clientOptions := gitlab.WithBaseURL("https://" + baseUrl) var err error gitProvider.client, err = gitlab.NewClient(gitProvider.token, clientOptions) From a725834acbf492f5ef052559703c6a8f2444141b Mon Sep 17 00:00:00 2001 From: Eriks Zelenka Date: Sat, 7 Dec 2024 19:28:25 +0000 Subject: [PATCH 13/20] Fix typo --- gitget/get.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/gitget/get.go b/gitget/get.go index 675df57..b8d4514 100644 --- a/gitget/get.go +++ b/gitget/get.go @@ -466,7 +466,7 @@ func (repo *Repo) GitPull() { } else { log.Debugf( "%s: Skip pulling upstream changes for '%s' which is not a branch", - repo.sha, colorRef.Sprintf(repo.Ref)) + repo.sha, colorRef.Sprintf("%s", repo.Ref)) } } @@ -519,7 +519,7 @@ func (repo *Repo) ProcessRepoBasedOnCurrentBranch() { if !stayOnRef { repo.GitCheckout(currentBranch) } else { - log.Debugf("%s: Stay on ref branch '%s'", repo.sha, colorRef.Sprintf(repo.Ref)) + log.Debugf("%s: Stay on ref branch '%s'", repo.sha, colorRef.Sprintf("%s", repo.Ref)) } } } @@ -643,7 +643,7 @@ func (repo *Repo) EnsureGitlabMirrorExists() { } } -func DecomposeGitURL(gitURL string) (string, string, string) { +func DecomposeGitURL(gitURL string) (baseURL, fullName, shortName string) { // input: git@abc.com:b/c/d.git or https://abc.com/b/c/d.git -> abc.com/b/c/d // remove unwanted parts of the git repo url re := regexp.MustCompile(`.git$|^https://|^git@`) @@ -653,10 +653,10 @@ func DecomposeGitURL(gitURL string) (string, string, string) { // baseURL and longPath for checking repo existence ( abc.com/b/c/d -> abc.com , b/c/d ) urlParts := strings.SplitN(url, "/", 2) - baseURL, fullName := urlParts[0], urlParts[1] + baseURL, fullName = urlParts[0], urlParts[1] // baseURL and project Name for creating missing repository ( abc.com/b/c/d -> abc.com/b/c , d) - _, shortName := filepath.Split(url) + _, shortName = filepath.Split(url) // ( abc.com/b/c/d -> abc.com, b/c/d, d ) return baseURL, fullName, shortName From 9979d5cf712285924d8600079cc09a18c0654724 Mon Sep 17 00:00:00 2001 From: Eriks Zelenka Date: Sat, 7 Dec 2024 19:38:50 +0000 Subject: [PATCH 14/20] Fix typo --- .golangci.yml | 3 ++- cmd/config_gen.go | 2 +- cmd/root.go | 36 ++++++++++++++++++++---------------- gitget/get.go | 6 +++--- 4 files changed, 26 insertions(+), 21 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 8d23288..42dff15 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -54,7 +54,8 @@ linters: linters-settings: gosec: excludes: - - G402 + - G401 + - G505 gocritic: enabled-checks: # Diagnostic diff --git a/cmd/config_gen.go b/cmd/config_gen.go index 3d2464e..ad47a24 100644 --- a/cmd/config_gen.go +++ b/cmd/config_gen.go @@ -62,7 +62,7 @@ git-get config-gen -f Gitfile -p "github" -u "git@github.com:AcmeOrg" -t AcmeOrg gitCloudProviderRootURL, gitCloudProvider, targetClonePath, - configGenParams, + &configGenParams, ) }, } diff --git a/cmd/root.go b/cmd/root.go index 396a81e..a15acb0 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -36,24 +36,28 @@ import ( var configGenParams gitget.ConfigGenParamsStruct -var cfgFile string -var cfgFiles []string -var ignoreFiles []string -var logLevel string -var stayOnRef bool -var shallow bool -var concurrencyLevel int -var pushMirror bool -var dryRun bool -var gitCloudProviderRootURL string -var targetClonePath string -var defaultMainBranch string -var status bool -var gitCloudProvider string +var ( + cfgFile string + cfgFiles []string + ignoreFiles []string + logLevel string + stayOnRef bool + shallow bool + concurrencyLevel int + pushMirror bool + dryRun bool + gitCloudProviderRootURL string + targetClonePath string + defaultMainBranch string + status bool + gitCloudProvider string +) // Mirroring specific vars -var mirrorVisibilityMode string -var mirrorBitbucketProjectName string +var ( + mirrorVisibilityMode string + mirrorBitbucketProjectName string +) var levels = map[string]log.Level{ "panic": log.PanicLevel, diff --git a/gitget/get.go b/gitget/get.go index b8d4514..572bb32 100644 --- a/gitget/get.go +++ b/gitget/get.go @@ -237,7 +237,7 @@ func (repo *Repo) PrepareForGet() { } // PrepareForMirror - set repository structure fields for mirror operation -func (repo *Repo) PrepareForMirror(pathPrefix string, mirrorRootURL string) { +func (repo *Repo) PrepareForMirror(pathPrefix, mirrorRootURL string) { repo.SetShellRunner(shellRunner) repo.SetTempRepoPathForMirror(pathPrefix) repo.SetDefaultRef() @@ -271,8 +271,8 @@ func (repo *Repo) SetRepoFullPath() { } // PathExists returns `true` if given `path` passed as sting exists, otherwise returns false. -func PathExists(path string) (bool, os.FileInfo) { - finfo, err := os.Stat(path) +func PathExists(pathToCheck string) (bool, os.FileInfo) { + finfo, err := os.Stat(pathToCheck) if os.IsNotExist(err) { return false, finfo From 286548c62de4bc1ee2140c3748d3d06d629c2667 Mon Sep 17 00:00:00 2001 From: Eriks Zelenka Date: Sat, 7 Dec 2024 19:40:51 +0000 Subject: [PATCH 15/20] Fix typo --- .github/workflows/reviewdog.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/reviewdog.yaml b/.github/workflows/reviewdog.yaml index 59aa656..79e7d3b 100644 --- a/.github/workflows/reviewdog.yaml +++ b/.github/workflows/reviewdog.yaml @@ -16,8 +16,8 @@ jobs: # https://github.com/reviewdog/action-golangci-lint/releases - name: golangci-lint uses: reviewdog/action-golangci-lint@v2 - with: - golangci_lint_flags: "--timeout=15m" + # with: + # golangci_lint_flags: "--timeout=15m" # UPDATE_HERE # https://github.com/reviewdog/action-actionlint/releases From 20b7c4c1f36bf462ca95a662d3394b17d88e3bae Mon Sep 17 00:00:00 2001 From: Eriks Zelenka Date: Sat, 7 Dec 2024 19:42:46 +0000 Subject: [PATCH 16/20] Fix typo --- gitget/get.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gitget/get.go b/gitget/get.go index 572bb32..8b8089d 100644 --- a/gitget/get.go +++ b/gitget/get.go @@ -1134,7 +1134,7 @@ func GenerateGitfileConfig( gitCloudProviderRootURL string, gitCloudProvider string, targetClonePath string, - configGenParams ConfigGenParamsStruct, + configGenParams *ConfigGenParamsStruct, ) { initColors() repoSha := generateSha(gitCloudProviderRootURL) @@ -1152,7 +1152,7 @@ func GenerateGitfileConfig( ignoreRepoList, gitCloudProviderRootURL, targetClonePath, - &configGenParams, + configGenParams, ) case "gitlab": repoList = fetchGitlabRepos( @@ -1160,7 +1160,7 @@ func GenerateGitfileConfig( ignoreRepoList, gitCloudProviderRootURL, targetClonePath, - &configGenParams, + configGenParams, ) case "bitbucket": repoList = fetchBitbucketRepos( @@ -1168,7 +1168,7 @@ func GenerateGitfileConfig( ignoreRepoList, gitCloudProviderRootURL, targetClonePath, - &configGenParams, + configGenParams, ) default: log.Fatalf("%s: Error: unknown '%s' git mirror provider", repoSha, gitCloudProvider) From 593ff567150c8192d392e47469927c7922f3b585 Mon Sep 17 00:00:00 2001 From: Eriks Zelenka Date: Sat, 7 Dec 2024 19:45:17 +0000 Subject: [PATCH 17/20] Fix typo --- gitget/get.go | 2 +- github/github.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gitget/get.go b/gitget/get.go index 8b8089d..e9b14aa 100644 --- a/gitget/get.go +++ b/gitget/get.go @@ -1058,7 +1058,7 @@ func fetchGitlabRepos( return repoList } -func writeReposToFile(repoSha string, cfgFile string, repoList []Repo) { +func writeReposToFile(repoSha, cfgFile string, repoList []Repo) { if len(repoList) > 0 { log.Infof( "%s: Final number of repositories to be written to '%s': '%d'", diff --git a/github/github.go b/github/github.go index 9f7324a..44696a8 100644 --- a/github/github.go +++ b/github/github.go @@ -50,7 +50,7 @@ func githubAuth(ctx context.Context, repositorySha string) *github.Client { } // RepositoryExists - check if remote github repository exists -func RepositoryExists(ctx context.Context, repositorySha string, owner string, repository string) bool { +func RepositoryExists(ctx context.Context, repositorySha, owner, repository string) bool { git := githubAuth(ctx, repositorySha) repo, _, err := git.Repositories.Get(ctx, owner, repository) From bfc32a92eeeb19684f2b08cbfa7d3d5d79f41d45 Mon Sep 17 00:00:00 2001 From: Eriks Zelenka Date: Sat, 7 Dec 2024 19:48:35 +0000 Subject: [PATCH 18/20] Fix typo --- gitlab/gitlab.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gitlab/gitlab.go b/gitlab/gitlab.go index cdcc38f..9136491 100644 --- a/gitlab/gitlab.go +++ b/gitlab/gitlab.go @@ -237,7 +237,7 @@ func (gitProvider *GitGetGitlab) getGroupID( foundGroups[group].ID, foundGroups[group].FullName, ) - if groupName == strings.Replace(foundGroups[group].FullName, " ", "", -1) { + if groupName == strings.ReplaceAll(foundGroups[group].FullName, " ", "") { return foundGroups[group].ID, foundGroups[group].FullName, nil } } From f1fe7d44a2bb485ac112f9475892cfb88e7ff26c Mon Sep 17 00:00:00 2001 From: Eriks Zelenka Date: Sat, 7 Dec 2024 19:50:31 +0000 Subject: [PATCH 19/20] Fix typo --- .golangci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.golangci.yml b/.golangci.yml index 42dff15..971ea1a 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -19,7 +19,6 @@ linters: - asciicheck - bodyclose - errcheck - - exportloopref - goconst - gocritic - gofmt From 6f0f701d0f97deae0d865bb4c279561b1b92c9a1 Mon Sep 17 00:00:00 2001 From: Eriks Zelenka Date: Sat, 7 Dec 2024 19:55:04 +0000 Subject: [PATCH 20/20] Fix typo --- bitbucket/bitbucket.go | 4 ++-- gitget/get.go | 17 +++++++++++------ gitlab/gitlab.go | 2 +- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/bitbucket/bitbucket.go b/bitbucket/bitbucket.go index c7d1175..bab4d19 100644 --- a/bitbucket/bitbucket.go +++ b/bitbucket/bitbucket.go @@ -58,7 +58,7 @@ func GenerateProjectKey(projectName string) string { } // RepositoryExists - checks if bitbucket repository exists -func RepositoryExists(repoSha string, owner string, repository string) bool { +func RepositoryExists(repoSha, owner, repository string) bool { git := bitbucketAuth(repoSha) repoOptions := &bitbucket.RepositoryOptions{ @@ -76,7 +76,7 @@ func RepositoryExists(repoSha string, owner string, repository string) bool { } // ProjectExists - checks if bitbucket project exists -func ProjectExists(git *bitbucket.Client, repoSha string, workspace string, project string) bool { +func ProjectExists(git *bitbucket.Client, repoSha, workspace, project string) bool { opt := &bitbucket.ProjectOptions{ Owner: workspace, Name: project, diff --git a/gitget/get.go b/gitget/get.go index e9b14aa..2a202c6 100644 --- a/gitget/get.go +++ b/gitget/get.go @@ -49,6 +49,11 @@ import ( "github.com/isindir/git-get/gitlab" ) +const ( + HTTPS = "https" + SSH = "ssh" +) + var ( stayOnRef bool defaultMainBranch = "master" @@ -893,12 +898,12 @@ func fetchGithubRepos( for repo := 0; repo < len(ghRepoList); repo++ { var gitGetRepoDefinition Repo switch configGenParams.GitSchema { - case "ssh": + case SSH: gitGetRepoDefinition = Repo{ URL: *ghRepoList[repo].SSHURL, Ref: *ghRepoList[repo].DefaultBranch, } - case "https": + case HTTPS: gitGetRepoDefinition = Repo{ URL: *ghRepoList[repo].HTMLURL, Ref: *ghRepoList[repo].DefaultBranch, @@ -949,10 +954,10 @@ func getBitbucketRepositoryGitURL( for j := 0; j < len(bbLinks); j++ { log.Debugf("%+v", bbLinks[j]) - if (bbLinks[j].Name == "ssh") && (gitSchema == "ssh") { + if (bbLinks[j].Name == SSH) && (gitSchema == SSH) { return bbLinks[j].HREF } - if (bbLinks[j].Name == "https") && (gitSchema == "https") { + if (bbLinks[j].Name == HTTPS) && (gitSchema == HTTPS) { return bbLinks[j].HREF } } @@ -1028,12 +1033,12 @@ func fetchGitlabRepos( var gitGetRepoDefinition Repo switch configGenParams.GitSchema { - case "ssh": + case SSH: gitGetRepoDefinition = Repo{ URL: glRepoList[repo].SSHURLToRepo, Ref: glRepoList[repo].DefaultBranch, } - case "https": + case HTTPS: gitGetRepoDefinition = Repo{ URL: glRepoList[repo].HTTPURLToRepo, Ref: glRepoList[repo].DefaultBranch, diff --git a/gitlab/gitlab.go b/gitlab/gitlab.go index 9136491..50c0679 100644 --- a/gitlab/gitlab.go +++ b/gitlab/gitlab.go @@ -121,7 +121,7 @@ func (gitProvider *GitGetGitlab) auth(repositorySha, baseUrl string) bool { } // ProjectExists checks if project exists and returns boolean if API call is successful -func (gitProvider *GitGetGitlab) ProjectExists(repositorySha string, baseUrl string, projectName string) bool { +func (gitProvider *GitGetGitlab) ProjectExists(repositorySha, baseUrl, projectName string) bool { log.Debugf("%s: Checking repository '%s' '%s' existence", repositorySha, baseUrl, projectName) gitProvider.auth(repositorySha, baseUrl)