Skip to content

Commit

Permalink
CR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
RobiNino committed Apr 30, 2024
1 parent 4b5aba6 commit 1c0b995
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 18 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ require (

// replace github.com/jfrog/jfrog-cli-core/v2 => github.com/jfrog/jfrog-cli-core/v2 v2.31.1-0.20240408074156-13680c04f22e

replace github.com/jfrog/jfrog-client-go => github.com/RobiNino/jfrog-client-go v0.0.0-20240424105747-4b5578ac857d
replace github.com/jfrog/jfrog-client-go => github.com/RobiNino/jfrog-client-go v0.0.0-20240430104400-70fe282735a9

// replace github.com/jfrog/jfrog-cli-security => github.com/jfrog/jfrog-cli-security v1.0.6-0.20240408061620-c9b84da33d5e

Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ github.com/Microsoft/hcsshim v0.11.4 h1:68vKo2VN8DE9AdN4tnkWnmdhqdbpUFM8OF3Airm7
github.com/Microsoft/hcsshim v0.11.4/go.mod h1:smjE4dvqPX9Zldna+t5FG3rnoHhaB7QYxPRqGcpAD9w=
github.com/ProtonMail/go-crypto v1.0.0 h1:LRuvITjQWX+WIfr930YHG2HNfjR1uOfyf5vE0kC2U78=
github.com/ProtonMail/go-crypto v1.0.0/go.mod h1:EjAoLdwvbIOoOQr3ihjnSoLZRtE8azugULFRteWMNc0=
github.com/RobiNino/jfrog-client-go v0.0.0-20240424105747-4b5578ac857d h1:8qFJq6tUsIUVthoy/ku14tZro5iCi5fc/hj6x+n5DNI=
github.com/RobiNino/jfrog-client-go v0.0.0-20240424105747-4b5578ac857d/go.mod h1:FprEW0Sqhj6ZSFTFk9NCni+ovFAYMA3zCBmNX4hGXgQ=
github.com/RobiNino/jfrog-client-go v0.0.0-20240430104400-70fe282735a9 h1:7We6Lh+KpiKhlAeDQp1jl8cQSpoPhsHTnxQ7L+5xe1c=
github.com/RobiNino/jfrog-client-go v0.0.0-20240430104400-70fe282735a9/go.mod h1:FprEW0Sqhj6ZSFTFk9NCni+ovFAYMA3zCBmNX4hGXgQ=
github.com/VividCortex/ewma v1.2.0 h1:f58SaIzcDXrSy3kWaHNvuJgJ3Nmz59Zji6XoJR/q1ow=
github.com/VividCortex/ewma v1.2.0/go.mod h1:nz4BbCtbLyFDeC9SUHbtcT5644juEuWfUAUnGx7j5l4=
github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d h1:licZJFw2RwpHMqeKTCYkitsPqHNxTmd4SNR5r94FGM8=
Expand Down
9 changes: 4 additions & 5 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ func execMain() error {
clientlog.Warn(warningMessage)
}
if err = setUberTraceIdToken(); err != nil {
clientlog.Debug("failed generating a trace ID token:", err.Error())
clientlog.Warn("failed generating a trace ID token:", err.Error())
}
return nil
}
Expand All @@ -164,14 +164,13 @@ func setUberTraceIdToken() error {
// Generates a 16 chars hexadecimal string to be used as a Trace ID token.
func generateTraceIdToken() (string, error) {
// Generate 8 random bytes.
var buf [8]byte
_, err := rand.Read(buf[:])
buf := make([]byte, 8)
_, err := rand.Read(buf)
if err != nil {
return "", errorutils.CheckError(err)
}

// Convert the random bytes to a 16 chars hexadecimal string.
return hex.EncodeToString(buf[:]), nil
return hex.EncodeToString(buf), nil
}

// Detects typos and can identify one or more valid commands similar to the error command.
Expand Down
12 changes: 2 additions & 10 deletions main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -360,14 +360,6 @@ func TestGenerateAndLogTraceIdToken(t *testing.T) {
traceIdToken, err := generateTraceIdToken()
assert.NoError(t, err)
assert.Len(t, traceIdToken, 16)

for _, char := range traceIdToken {
if !isHexChar(char) {
assert.Fail(t, "unexpected: trace ID token contains non-hex characters: '%s'", traceIdToken)
}
}
}

func isHexChar(char rune) bool {
return ('0' <= char && char <= '9') || ('a' <= char && char <= 'f') || ('A' <= char && char <= 'F')
_, err = strconv.ParseUint(traceIdToken, 16, 64)
assert.NoError(t, err, "unexpected: trace ID token contains non-hex characters")
}

0 comments on commit 1c0b995

Please sign in to comment.