Skip to content

Commit

Permalink
Fix lint issues and update dependencies (#1894)
Browse files Browse the repository at this point in the history
  • Loading branch information
sverdlov93 committed Apr 3, 2023
1 parent d3a4707 commit 88766eb
Show file tree
Hide file tree
Showing 9 changed files with 45 additions and 28 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/nugetTests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on:
push:
# Triggers the workflow on labeled PRs only.
pull_request_target:
types: [labeled]
types: [ labeled ]
# Ensures that only the latest commit is running for each PR at a time.
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}-${{ github.ref }}
Expand All @@ -15,7 +15,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
os: [ ubuntu-latest, macos-latest, windows-latest ]
runs-on: ${{ matrix.os }}
steps:
- name: Install Go
Expand All @@ -25,11 +25,11 @@ jobs:
- name: Install NuGet
uses: nuget/setup-nuget@v1
with:
nuget-version: 5.x
nuget-version: 6.x
- name: Install dotnet
uses: actions/setup-dotnet@v2
uses: actions/setup-dotnet@v3
with:
dotnet-version: "3.x"
dotnet-version: "6.x"
- name: Checkout code
uses: actions/checkout@v3
with:
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/xrayTests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on:
push:
# Triggers the workflow on labeled PRs only.
pull_request_target:
types: [labeled]
types: [ labeled ]
# Ensures that only the latest commit is running for each PR at a time.
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}-${{ github.ref }}
Expand All @@ -15,7 +15,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
os: [ ubuntu-latest, macos-latest, windows-latest ]
runs-on: ${{ matrix.os }}
env:
GRADLE_OPTS: -Dorg.gradle.daemon=false
Expand All @@ -36,11 +36,11 @@ jobs:
- name: Install NuGet
uses: nuget/setup-nuget@v1
with:
nuget-version: 5.x
nuget-version: 6.x
- name: Install dotnet
uses: actions/setup-dotnet@v2
uses: actions/setup-dotnet@v3
with:
dotnet-version: "3.x"
dotnet-version: "6.x"
- name: Setup Python3
uses: actions/setup-python@v4
with:
Expand Down
2 changes: 0 additions & 2 deletions artifactory/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -1031,7 +1031,6 @@ func getSplitCount(c *cli.Context) (splitCount int, err error) {

func getMinSplit(c *cli.Context) (minSplitSize int64, err error) {
minSplitSize = cliutils.DownloadMinSplitKb
err = nil
if c.String("min-split") != "" {
minSplitSize, err = strconv.ParseInt(c.String("min-split"), 10, 64)
if err != nil {
Expand All @@ -1045,7 +1044,6 @@ func getMinSplit(c *cli.Context) (minSplitSize int64, err error) {

func getRetries(c *cli.Context) (retries int, err error) {
retries = cliutils.Retries
err = nil
if c.String("retries") != "" {
retries, err = strconv.Atoi(c.String("retries"))
if err != nil {
Expand Down
1 change: 0 additions & 1 deletion general/cisetup/cisetup.go
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,6 @@ func (cc *CiSetupCommand) xrayConfigPhase() (err error) {
return err
} else {
log.Debug(err.(*xrayservices.PolicyAlreadyExistsError).InnerError)
err = nil
}
}
// Create new default watcher.
Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ require (
github.com/BurntSushi/toml v1.2.1 // indirect
github.com/CycloneDX/cyclonedx-go v0.7.0 // indirect
github.com/Microsoft/go-winio v0.5.2 // indirect
github.com/ProtonMail/go-crypto v0.0.0-20230217124315-7d5c6f04bbb8 // indirect
github.com/ProtonMail/go-crypto v0.0.0-20230331115716-d34776aa93ec // indirect
github.com/VividCortex/ewma v1.2.0 // indirect
github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d // indirect
github.com/acomagu/bufpipe v1.0.4 // indirect
Expand Down Expand Up @@ -121,8 +121,8 @@ require (

// replace github.com/jfrog/build-info-go => github.com/jfrog/build-info-go v1.8.9-0.20230316095417-a9f6b73206d7

// replace github.com/jfrog/jfrog-client-go => github.com/jfrog/jfrog-client-go v1.27.1-0.20230330144818-575d283503f2
replace github.com/jfrog/jfrog-client-go => github.com/jfrog/jfrog-client-go v1.28.1-0.20230403143646-28f93098b1e6

// replace github.com/jfrog/jfrog-cli-core/v2 => github.com/jfrog/jfrog-cli-core/v2 v2.30.1-0.20230330152513-de72d129d6a0
replace github.com/jfrog/jfrog-cli-core/v2 => github.com/jfrog/jfrog-cli-core/v2 v2.31.1-0.20230403151438-7b671f1f663a

// replace github.com/jfrog/gofrog => github.com/jfrog/gofrog v1.2.5-0.20221107113836-a4c9225c690e
14 changes: 9 additions & 5 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,9 @@ github.com/CycloneDX/cyclonedx-go v0.7.0/go.mod h1:W5Z9w8pTTL+t+yG3PCiFRGlr8PUlE
github.com/Microsoft/go-winio v0.5.2 h1:a9IhgEQBCUEk6QCdml9CiJGhAws+YwffDHEMp1VMrpA=
github.com/Microsoft/go-winio v0.5.2/go.mod h1:WpS1mjBmmwHBEWmogvA2mj8546UReBk4v8QkMxJ6pZY=
github.com/Microsoft/hcsshim v0.9.7 h1:mKNHW/Xvv1aFH87Jb6ERDzXTJTLPlmzfZ28VBFD/bfg=
github.com/ProtonMail/go-crypto v0.0.0-20230217124315-7d5c6f04bbb8 h1:wPbRQzjjwFc0ih8puEVAOFGELsn1zoIIYdxvML7mDxA=
github.com/ProtonMail/go-crypto v0.0.0-20230217124315-7d5c6f04bbb8/go.mod h1:I0gYDMZ6Z5GRU7l58bNFSkPTFN6Yl12dsUlAZ8xy98g=
github.com/ProtonMail/go-crypto v0.0.0-20230331115716-d34776aa93ec h1:eQusauqzE1cAFR5hGnwkuSmFxKoy3+j9/cVaDeYfjjs=
github.com/ProtonMail/go-crypto v0.0.0-20230331115716-d34776aa93ec/go.mod h1:8TI4H3IbrackdNgv+92dI+rhpCaLqM0IfpgCgenFvRE=
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 Expand Up @@ -241,10 +242,10 @@ github.com/jfrog/build-info-go v1.9.0 h1:gLxBfp4C6pVz+bKTmsqwFGZAueVMuzGw+/M9HZg
github.com/jfrog/build-info-go v1.9.0/go.mod h1:dQ8OKddrbgtO3jK9uLYoqmRGNEjuDuNXV0bSRdpeTCI=
github.com/jfrog/gofrog v1.2.5 h1:jCgJC0iGQ8bU7jCC+YEFJTNINyngApIrhd8BjZAVRIE=
github.com/jfrog/gofrog v1.2.5/go.mod h1:o00tSRff6IapTgaCMuX1Cs9MH08Y1JqnsKgRtx91Gc4=
github.com/jfrog/jfrog-cli-core/v2 v2.31.0 h1:kKWc37KSquiu/sKOETu6o5bXqHWCoyg7Do7BZl/huFo=
github.com/jfrog/jfrog-cli-core/v2 v2.31.0/go.mod h1:ck+ik2FmKG+VCDevePiURC+Zl5O3oLrMfSQk4jNH9Z0=
github.com/jfrog/jfrog-client-go v1.28.0 h1:PZzcoZZESgSWStd7WK71hpR4LxF1ih89r4XWzZr6Ng0=
github.com/jfrog/jfrog-client-go v1.28.0/go.mod h1:tBaVE+j1Dgo3BcGGBuFm0jbOmjNTaZadwo6jvFiv89Y=
github.com/jfrog/jfrog-cli-core/v2 v2.31.1-0.20230403151438-7b671f1f663a h1:xRUNJ+8xr+vRCY2SyuGnFq398NFfemtqsGE5LjE+gxQ=
github.com/jfrog/jfrog-cli-core/v2 v2.31.1-0.20230403151438-7b671f1f663a/go.mod h1:VpqBCXjeFpdCalRH2JAmGhKo604alKAPhpPGxiY4DJQ=
github.com/jfrog/jfrog-client-go v1.28.1-0.20230403143646-28f93098b1e6 h1:ky2zWqy6vdg2R3txuXpTUOtm6FEbkDKOPhwTokIDEZU=
github.com/jfrog/jfrog-client-go v1.28.1-0.20230403143646-28f93098b1e6/go.mod h1:ir1HEkCwISLjwbMmXBjbOrFqk6InFREPjbvg/5VKOJI=
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk=
github.com/jszwec/csvutil v1.8.0 h1:G7vS2LGdpZZDH1HmHeNbxOaJ/ZnJlpwGFvOkTkJzzNk=
Expand Down Expand Up @@ -476,6 +477,7 @@ golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/mod v0.6.0/go.mod h1:4mET923SAdbXp2ki8ey+zGs1SLqsuM2Y0uvdZR/fUNI=
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/mod v0.9.0 h1:KENHtAZL2y3NLMYZeHY9DW8HW8V+kQyJsY/V9JlKvCs=
golang.org/x/mod v0.9.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
Expand Down Expand Up @@ -537,6 +539,7 @@ golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJ
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
Expand Down Expand Up @@ -681,6 +684,7 @@ golang.org/x/tools v0.0.0-20210108195828-e2f9c7f1fc8e/go.mod h1:emZCQorbCU4vsT4f
golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
golang.org/x/tools v0.2.0/go.mod h1:y4OqIKeOV/fWJetJ8bXPU1sEVniLMIyDAZWeHdV+NTA=
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
Expand Down
1 change: 0 additions & 1 deletion utils/cliutils/codegangstautils.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ func GetStringsArrFlagValue(c *cli.Context, flagName string) (resultArray []stri

func GetThreadsCount(c *cli.Context) (threads int, err error) {
threads = Threads
err = nil
if c.String("threads") != "" {
threads, err = strconv.Atoi(c.String("threads"))
if err != nil || threads < 1 {
Expand Down
2 changes: 1 addition & 1 deletion utils/progressbar/readerprogressbar.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func (pr *proxyReader) incrChannel(n int) {
// Therefore, the channel may be already closed at this stage, which leads to a panic.
// We therefore need to recover if that happens.
defer func() {
recover()
_ = recover()
}()
pr.unit.incrChannel <- n
}
27 changes: 22 additions & 5 deletions utils/tests/proxy/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,12 @@ func httpProxyHandler(w http.ResponseWriter, r *http.Request) {
clilog.Error(err)
}
origBody := resp.Body
defer origBody.Close()
defer func() {
err = origBody.Close()
if err != nil {
clilog.Error(err)
}
}()
copyHeaders(w.Header(), resp.Header)
w.WriteHeader(resp.StatusCode)
_, err = io.Copy(w, resp.Body)
Expand Down Expand Up @@ -133,7 +138,11 @@ func (t *testProxy) ServeHTTP(responseWriter http.ResponseWriter, request *http.
return
}

proxyClient.Write([]byte("HTTP/1.0 200 OK\r\n\r\n"))
_, err = proxyClient.Write([]byte("HTTP/1.0 200 OK\r\n\r\n"))
if err != nil {
clilog.Error(err)
return
}
targetTCP, targetOK := targetSiteCon.(*net.TCPConn)
proxyClientTCP, clientOK := proxyClient.(*net.TCPConn)
if targetOK && clientOK {
Expand All @@ -147,8 +156,16 @@ func copyAndClose(dst, src *net.TCPConn) {
if _, err := io.Copy(dst, src); err != nil {
clilog.Error(err)
}
dst.CloseWrite()
src.CloseRead()
err := dst.CloseWrite()
if err != nil {
clilog.Error(err)
return
}
err = src.CloseRead()
if err != nil {
clilog.Error(err)
return
}
}

func GetProxyHttpPort() string {
Expand Down Expand Up @@ -185,7 +202,7 @@ func CreateNewServerCertificates() (certFilePath, keyCertFilePath string, err er
return
}
}
errorutils.CheckError(err)
err = errorutils.CheckError(err)
return
}

Expand Down

0 comments on commit 88766eb

Please sign in to comment.