diff --git a/commands/audit/sca/go/golang.go b/commands/audit/sca/go/golang.go index e94ffb56..41528985 100644 --- a/commands/audit/sca/go/golang.go +++ b/commands/audit/sca/go/golang.go @@ -4,12 +4,11 @@ import ( "fmt" biutils "github.com/jfrog/build-info-go/utils" "github.com/jfrog/gofrog/datastructures" - "github.com/jfrog/jfrog-cli-core/v2/utils/config" + goartifactoryutils "github.com/jfrog/jfrog-cli-core/v2/artifactory/commands/golang" "github.com/jfrog/jfrog-cli-core/v2/utils/coreutils" goutils "github.com/jfrog/jfrog-cli-core/v2/utils/golang" "github.com/jfrog/jfrog-cli-security/utils" xrayUtils "github.com/jfrog/jfrog-client-go/xray/services/utils" - "os" "strings" ) @@ -32,7 +31,7 @@ func BuildDependencyTree(params utils.AuditParams) (dependencyTree []*xrayUtils. remoteGoRepo := params.DepsRepo() if remoteGoRepo != "" { - if err = setGoProxy(server, remoteGoRepo); err != nil { + if err = goartifactoryutils.SetArtifactoryAsResolutionServer(server, remoteGoRepo); err != nil { return } } @@ -71,15 +70,6 @@ func BuildDependencyTree(params utils.AuditParams) (dependencyTree []*xrayUtils. return } -func setGoProxy(server *config.ServerDetails, remoteGoRepo string) error { - repoUrl, err := goutils.GetArtifactoryRemoteRepoUrl(server, remoteGoRepo) - if err != nil { - return err - } - repoUrl += "|direct" - return os.Setenv("GOPROXY", repoUrl) -} - func populateGoDependencyTree(currNode *xrayUtils.GraphNode, dependenciesGraph map[string][]string, dependenciesList map[string]bool, uniqueDepsSet *datastructures.Set[string]) { if currNode.NodeHasLoop() { return diff --git a/go.mod b/go.mod index f29725a8..b3054a58 100644 --- a/go.mod +++ b/go.mod @@ -98,6 +98,6 @@ require ( gopkg.in/warnings.v0 v0.1.2 // indirect ) -replace github.com/jfrog/jfrog-cli-core/v2 => github.com/jfrog/jfrog-cli-core/v2 v2.31.1-0.20240215164428-40b164662f24 +replace github.com/jfrog/jfrog-cli-core/v2 => github.com/jfrog/jfrog-cli-core/v2 v2.31.1-0.20240218125754-97305051f203 -replace github.com/jfrog/jfrog-client-go => github.com/jfrog/jfrog-client-go v1.28.1-0.20240214150718-c734e234d315 +replace github.com/jfrog/jfrog-client-go => github.com/jfrog/jfrog-client-go v1.28.1-0.20240218093454-1c352a93c23d diff --git a/go.sum b/go.sum index bf9572f2..d01e3f1a 100644 --- a/go.sum +++ b/go.sum @@ -94,10 +94,10 @@ github.com/jfrog/gofrog v1.6.0 h1:jOwb37nHY2PnxePNFJ6e6279Pgkr3di05SbQQw47Mq8= github.com/jfrog/gofrog v1.6.0/go.mod h1:SZ1EPJUruxrVGndOzHd+LTiwWYKMlHqhKD+eu+v5Hqg= github.com/jfrog/jfrog-apps-config v1.0.1 h1:mtv6k7g8A8BVhlHGlSveapqf4mJfonwvXYLipdsOFMY= github.com/jfrog/jfrog-apps-config v1.0.1/go.mod h1:8AIIr1oY9JuH5dylz2S6f8Ym2MaadPLR6noCBO4C22w= -github.com/jfrog/jfrog-cli-core/v2 v2.31.1-0.20240215164428-40b164662f24 h1:mDcEzrSDzFaEy25XhQ4fx385PboFv3qHBLrb0QjvTgM= -github.com/jfrog/jfrog-cli-core/v2 v2.31.1-0.20240215164428-40b164662f24/go.mod h1:xKh03WzFK7YlZtHNJdOzkMvFjyq75yeUWW5EKNKV2Qk= -github.com/jfrog/jfrog-client-go v1.28.1-0.20240214150718-c734e234d315 h1:A/pujr4z8wSFK5Atrr5NHnsl1Y758zP2++R99qNKDyE= -github.com/jfrog/jfrog-client-go v1.28.1-0.20240214150718-c734e234d315/go.mod h1:fV5wrs86ihQkFKfMKpGxMbNf3mbVT4LUf320C1T9C2M= +github.com/jfrog/jfrog-cli-core/v2 v2.31.1-0.20240218125754-97305051f203 h1:zPKW3AGH1kqgz4mtgGfhdXJNaxS+55cReFymSKXezdE= +github.com/jfrog/jfrog-cli-core/v2 v2.31.1-0.20240218125754-97305051f203/go.mod h1:+azTP7jL4ebGF//oVz+kCsLOIFxBp/19McVB0KHwT8U= +github.com/jfrog/jfrog-client-go v1.28.1-0.20240218093454-1c352a93c23d h1:59C2AOjdp5Wp/WoeQZkOGbAtKnhY1a9YhrnAdeVbVYs= +github.com/jfrog/jfrog-client-go v1.28.1-0.20240218093454-1c352a93c23d/go.mod h1:fV5wrs86ihQkFKfMKpGxMbNf3mbVT4LUf320C1T9C2M= github.com/kevinburke/ssh_config v1.2.0 h1:x584FjTGwHzMwvHx18PXxbBVzfnxogHaAReU4gf13a4= github.com/kevinburke/ssh_config v1.2.0/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM= github.com/klauspost/compress v1.4.1/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A=