Skip to content

Commit ed31bdb

Browse files
authored
Merge pull request #45 from andyzhangx/klog
cleanup: use klog instead of debug print
2 parents 4bf7601 + dbdc232 commit ed31bdb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+24843
-108
lines changed

.github/workflows/linux.yaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ on:
44
push: {}
55

66
jobs:
7-
87
build:
98
name: Build
109
runs-on: ubuntu-latest
@@ -19,6 +18,10 @@ jobs:
1918
- name: Check out code into the Go module directory
2019
uses: actions/checkout@v2
2120

22-
- name: Unit Test
21+
- name: Unit test
2322
run: |
2423
go test -v -race ./iscsi/...
24+
25+
- name: Build test
26+
run: |
27+
go build -a -mod vendor -o example/iscsi-lib-example ./example

.github/workflows/trivy.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Trivy vulnerability scanner
2+
on:
3+
pull_request: {}
4+
push: {}
5+
jobs:
6+
build:
7+
name: Build
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Set up Go 1.x
11+
uses: actions/setup-go@v2
12+
with:
13+
go-version: ^1.19
14+
id: go
15+
16+
- name: Checkout code
17+
uses: actions/checkout@v2
18+
19+
- name: Build a binary
20+
run: |
21+
go build -a -mod vendor -o example/iscsi-lib-example ./example
22+
23+
- name: Run Trivy vulnerability scanner
24+
uses: aquasecurity/trivy-action@master
25+
with:
26+
scan-type: fs
27+
scan-ref: 'example/iscsi-lib-example'
28+
ignore-unfixed: true
29+
vuln-type: 'os,library'
30+
format: 'table'
31+
exit-code: '1'
32+
severity: 'CRITICAL,HIGH,MEDIUM,LOW'

.github/workflows/windows.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Windows Tests
2+
on:
3+
pull_request: {}
4+
push: {}
5+
jobs:
6+
build:
7+
strategy:
8+
matrix:
9+
go-versions: [1.19.x]
10+
platform: [windows-latest]
11+
runs-on: ${{ matrix.platform }}
12+
steps:
13+
- name: Set up Go 1.x
14+
uses: actions/setup-go@v2
15+
with:
16+
go-version: ^1.19
17+
id: go
18+
- name: Checkout code
19+
uses: actions/checkout@v2
20+
- name: Build Test
21+
run: |
22+
go build -a -o example/iscsi-lib-example.exe ./example

example/main.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,11 @@ var (
1616
username = flag.String("username", "3aX7EEf3CEgvESQG75qh", "")
1717
password = flag.String("password", "eJBDC7Bt7WE3XFDq", "")
1818
lun = flag.Int("lun", 1, "")
19-
debug = flag.Bool("debug", false, "enable logging")
2019
)
2120

2221
func main() {
2322
flag.Parse()
2423
tgtps := strings.Split(*portals, ",")
25-
if *debug {
26-
iscsi.EnableDebugLogging(os.Stdout)
27-
}
2824

2925
// You can utilize the iscsiadm calls directly if you wish, but by creating a Connector
3026
// you can simplify interactions to simple calls like "Connect" and "Disconnect"

go.mod

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@ go 1.19
55
require (
66
github.com/prashantv/gostub v1.1.0
77
github.com/stretchr/testify v1.8.0
8+
k8s.io/klog/v2 v2.90.1
89
)
910

1011
require (
1112
github.com/davecgh/go-spew v1.1.1 // indirect
13+
github.com/go-logr/logr v1.2.0 // indirect
1214
github.com/pmezard/go-difflib v1.0.0 // indirect
13-
github.com/stretchr/objx v0.4.0 // indirect
1415
gopkg.in/yaml.v3 v3.0.1 // indirect
1516
)

go.sum

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,21 @@
1-
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
21
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
32
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
43
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
4+
github.com/go-logr/logr v1.2.0 h1:QK40JKJyMdUDz+h+xvCsru/bJhvG0UxvePV0ufL/AcE=
5+
github.com/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
56
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
67
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
7-
github.com/prashantv/gostub v1.0.0 h1:wTzvgO04xSS3gHuz6Vhuo0/kvWelyJxwNS0IRBPAwGY=
8-
github.com/prashantv/gostub v1.0.0/go.mod h1:dP1v6T1QzyGJJKFocwAU0lSZKpfjstjH8TlhkEU0on0=
98
github.com/prashantv/gostub v1.1.0 h1:BTyx3RfQjRHnUWaGF9oQos79AlQ5k8WNktv7VGvVH4g=
109
github.com/prashantv/gostub v1.1.0/go.mod h1:A5zLQHz7ieHGG7is6LLXLz7I8+3LZzsrV0P1IAHhP5U=
1110
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
12-
github.com/stretchr/objx v0.4.0 h1:M2gUjqZET1qApGOWNSnZ49BAIMX4F/1plDv3+l31EJ4=
1311
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
14-
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
15-
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
1612
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
1713
github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk=
1814
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
1915
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
2016
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
21-
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
2217
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
2318
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
2419
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
20+
k8s.io/klog/v2 v2.90.1 h1:m4bYOKall2MmOiRaR1J+We67Do7vm9KiQVlT96lnHUw=
21+
k8s.io/klog/v2 v2.90.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=

0 commit comments

Comments
 (0)