Skip to content

Commit 86e5239

Browse files
committed
fix: NVSHAS-9525 fix lint issues and enable linter
1 parent 96da052 commit 86e5239

File tree

4 files changed

+33
-6
lines changed

4 files changed

+33
-6
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: golangci-lint
2+
on:
3+
push:
4+
branches:
5+
- main
6+
- master
7+
pull_request:
8+
9+
jobs:
10+
golangci:
11+
name: lint
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
- uses: actions/setup-go@v5
16+
with:
17+
go-version: stable
18+
- name: golangci-lint
19+
uses: golangci/golangci-lint-action@v6
20+
with:
21+
version: v1.61
22+
args: --timeout=30m

caller/main.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ import (
55
"flag"
66
"fmt"
77
"io"
8-
"log"
98
"os/exec"
9+
10+
log "github.com/sirupsen/logrus"
1011
)
1112

1213
var proxyURL = flag.String("proxy-url", "", "")
@@ -32,7 +33,9 @@ func main() {
3233

3334
go func() {
3435
fmt.Println("writing to stdin")
35-
io.WriteString(stdin, *proxyLogin)
36+
if _, err := io.WriteString(stdin, *proxyLogin); err != nil {
37+
log.WithError(err).Error("Failed to write to stdin")
38+
}
3639
closeErr = stdin.Close()
3740
}()
3841

@@ -51,7 +54,9 @@ func main() {
5154
fmt.Println(scanner.Text())
5255
}
5356

54-
cmd.Wait()
57+
if err := cmd.Wait(); err != nil {
58+
log.WithError(err).Error("failed to wait for cmd")
59+
}
5560

5661
if closeErr != nil {
5762
fmt.Printf("error when closing stdin pipe: %s\n", closeErr)

http-client.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ func (p Proxy) BasicAuthorizationHeader() string {
2424
return "Basic " + encodedAuth
2525
}
2626

27-
func (p Proxy) HttpTransport() http.Transport {
27+
func (p Proxy) HttpTransport() *http.Transport {
2828
proxyURLFunc := func(r *http.Request) (*url.URL, error) {
2929
return url.Parse(p.URL)
3030
}
31-
transport := http.Transport{
31+
transport := &http.Transport{
3232
Proxy: proxyURLFunc,
3333
TLSClientConfig: &tls.Config{
3434
InsecureSkipVerify: true,

public_root_of_trust.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ func GetSigstorePublicTufTargets(usage sigtuf.UsageKind, proxy Proxy) ([]sigtuf.
3232
}
3333
if proxy.URL != "" {
3434
transport := proxy.HttpTransport()
35-
httpClient.Transport = &transport
35+
httpClient.Transport = transport
3636
} else {
3737
httpClient.Transport = &http.Transport{
3838
TLSClientConfig: &tls.Config{

0 commit comments

Comments
 (0)