Skip to content

Commit aec982a

Browse files
committed
Improve repositores code
Signed-off-by: Michael Sverdlov <[email protected]>
1 parent 2ee5950 commit aec982a

File tree

5 files changed

+10
-12
lines changed

5 files changed

+10
-12
lines changed

artifactory/commands/buildtoollogin/buildtoollogin.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package buildtoollogin
33
import (
44
"fmt"
55
biutils "github.com/jfrog/build-info-go/utils"
6+
gocommands "github.com/jfrog/jfrog-cli-core/v2/artifactory/commands/golang"
67
pythoncommands "github.com/jfrog/jfrog-cli-core/v2/artifactory/commands/python"
78
"github.com/jfrog/jfrog-cli-core/v2/artifactory/commands/repository"
89
commandsutils "github.com/jfrog/jfrog-cli-core/v2/artifactory/commands/utils"
@@ -11,7 +12,6 @@ import (
1112
"github.com/jfrog/jfrog-cli-core/v2/artifactory/utils/yarn"
1213
"github.com/jfrog/jfrog-cli-core/v2/common/project"
1314
"github.com/jfrog/jfrog-cli-core/v2/utils/config"
14-
goutils "github.com/jfrog/jfrog-cli-core/v2/utils/golang"
1515
"github.com/jfrog/jfrog-client-go/artifactory/services"
1616
"github.com/jfrog/jfrog-client-go/utils/errorutils"
1717
"github.com/jfrog/jfrog-client-go/utils/log"
@@ -200,7 +200,7 @@ func (btlc *BuildToolLoginCommand) configureYarn() error {
200200
//
201201
// go env -w GOPROXY=https://<user>:<token>@<your-artifactory-url>/artifactory/go/<repo-name>,direct
202202
func (btlc *BuildToolLoginCommand) configureGo() error {
203-
repoWithCredsUrl, err := goutils.GetArtifactoryRemoteRepoUrl(btlc.serverDetails, btlc.repoName, goutils.GoProxyUrlParams{Direct: true})
203+
repoWithCredsUrl, err := gocommands.GetArtifactoryRemoteRepoUrl(btlc.serverDetails, btlc.repoName, gocommands.GoProxyUrlParams{Direct: true})
204204
if err != nil {
205205
return err
206206
}

artifactory/commands/golang/go.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ func (gc *GoCommand) run() (err error) {
154154
return
155155
}
156156
// If noFallback=false, missing packages will be fetched directly from VCS
157-
repoUrl, err := getArtifactoryRemoteRepoUrl(resolverDetails, gc.resolverParams.TargetRepo(), GoProxyUrlParams{Direct: !gc.noFallback})
157+
repoUrl, err := GetArtifactoryRemoteRepoUrl(resolverDetails, gc.resolverParams.TargetRepo(), GoProxyUrlParams{Direct: !gc.noFallback})
158158
if err != nil {
159159
return
160160
}
@@ -336,7 +336,7 @@ func SetArtifactoryAsResolutionServer(serverDetails *config.ServerDetails, depsR
336336
}
337337

338338
func setGoProxy(server *config.ServerDetails, remoteGoRepo string, goProxyParams GoProxyUrlParams) error {
339-
repoUrl, err := getArtifactoryRemoteRepoUrl(server, remoteGoRepo, goProxyParams)
339+
repoUrl, err := GetArtifactoryRemoteRepoUrl(server, remoteGoRepo, goProxyParams)
340340
if err != nil {
341341
return err
342342
}
@@ -380,7 +380,7 @@ func (gdu *GoProxyUrlParams) addDirect(url string) string {
380380
return url
381381
}
382382

383-
func getArtifactoryRemoteRepoUrl(serverDetails *config.ServerDetails, repo string, goProxyParams GoProxyUrlParams) (string, error) {
383+
func GetArtifactoryRemoteRepoUrl(serverDetails *config.ServerDetails, repo string, goProxyParams GoProxyUrlParams) (string, error) {
384384
authServerDetails, err := serverDetails.CreateArtAuthConfig()
385385
if err != nil {
386386
return "", err

artifactory/commands/golang/go_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ func TestGetArtifactoryRemoteRepoUrl(t *testing.T) {
8686
AccessToken: "eyJ0eXAiOiJKV1QifQ.eyJzdWIiOiJmYWtlXC91c2Vyc1wvdGVzdCJ9.MTIzNDU2Nzg5MA",
8787
}
8888
repoName := "test-repo"
89-
repoUrl, err := getArtifactoryRemoteRepoUrl(server, repoName, GoProxyUrlParams{})
89+
repoUrl, err := GetArtifactoryRemoteRepoUrl(server, repoName, GoProxyUrlParams{})
9090
assert.NoError(t, err)
9191
assert.Equal(t, "https://test:eyJ0eXAiOiJKV1QifQ.eyJzdWIiOiJmYWtlXC91c2Vyc1wvdGVzdCJ9.MTIzNDU2Nzg5MA@server.com/artifactory/api/go/test-repo", repoUrl)
9292
}

artifactory/utils/npm/config-delete.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package npm
22

33
import (
44
gofrogcmd "github.com/jfrog/gofrog/io"
5-
npmutils "github.com/jfrog/jfrog-cli-core/v2/utils/npm"
65
"github.com/jfrog/jfrog-client-go/utils/errorutils"
76
)
87

@@ -15,8 +14,8 @@ func ConfigDelete(key, executablePath string) error {
1514
return nil
1615
}
1716

18-
func createConfigDeleteCmdConfig(executablePath, key string) *npmutils.NpmConfig {
19-
return &npmutils.NpmConfig{
17+
func createConfigDeleteCmdConfig(executablePath, key string) *NpmConfig {
18+
return &NpmConfig{
2019
Npm: executablePath,
2120
Command: []string{"config", "delete", key},
2221
StrWriter: nil,

artifactory/utils/npm/config-set.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package npm
22

33
import (
44
gofrogcmd "github.com/jfrog/gofrog/io"
5-
npmutils "github.com/jfrog/jfrog-cli-core/v2/utils/npm"
65
"github.com/jfrog/jfrog-client-go/utils/errorutils"
76
)
87

@@ -15,8 +14,8 @@ func ConfigSet(key, value, executablePath string) error {
1514
return nil
1615
}
1716

18-
func createConfigSetCmdConfig(executablePath, key, value string) *npmutils.NpmConfig {
19-
return &npmutils.NpmConfig{
17+
func createConfigSetCmdConfig(executablePath, key, value string) *NpmConfig {
18+
return &NpmConfig{
2019
Npm: executablePath,
2120
Command: []string{"config", "set", key, value},
2221
StrWriter: nil,

0 commit comments

Comments
 (0)