Skip to content

Commit

Permalink
Adding stringer for usage and CI/CD
Browse files Browse the repository at this point in the history
Signed-off-by: ritikaguptams <85255050+ritikaguptams@users.noreply.github.com>

Fixing build errors

Signed-off-by: ritikaguptams <85255050+ritikaguptams@users.noreply.github.com>

Ignore linting for files generated by Stringer

Signed-off-by: ritikaguptams <85255050+ritikaguptams@users.noreply.github.com>

Trying to fix CI go gen

Signed-off-by: ritikaguptams <85255050+ritikaguptams@users.noreply.github.com>

Removing extra step to fix CI go gen

Signed-off-by: ritikaguptams <85255050+ritikaguptams@users.noreply.github.com>

go gen CI fix try 2

Signed-off-by: ritikaguptams <85255050+ritikaguptams@users.noreply.github.com>

Skip autogenerated file from linting

Signed-off-by: ritikaguptams <85255050+ritikaguptams@users.noreply.github.com>

Fixing linting

Signed-off-by: ritikaguptams <85255050+ritikaguptams@users.noreply.github.com>
  • Loading branch information
ritikaguptams committed Jun 20, 2024
1 parent 81ea36e commit c193dae
Show file tree
Hide file tree
Showing 49 changed files with 11,832 additions and 6 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,12 @@ jobs:
go.sum
test/go.sum
Install Stringer
- name: Install stringer
run: |
go install golang.org/x/tools/cmd/stringer@latest
echo "${{ runner.os }}-latest" >> $GITHUB_PATH
- name: Pre-fill Module Cache
shell: powershell
run: |
Expand Down Expand Up @@ -348,7 +354,7 @@ jobs:
# accept the eula
& '${{ github.workspace }}/bin/psexec' -accepteula -nobanner cmd /c "exit 0" 2>$null
# run tests
- name: Test repo
run: ${{ env.GOTESTSUM_CMD }} -gcflags=all=-d=checkptr -tags admin -timeout=20m ./...
Expand Down
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -171,4 +171,4 @@ issues:
- path: internal\\vhdx\\info
linters:
- stylecheck
Text: "ST1003:"
Text: "ST1003:"
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ require (
go.uber.org/mock v0.4.0
golang.org/x/sync v0.7.0
golang.org/x/sys v0.21.0
golang.org/x/tools v0.15.0
google.golang.org/grpc v1.64.0
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.4.0
google.golang.org/protobuf v1.34.2
Expand Down Expand Up @@ -110,7 +111,6 @@ require (
golang.org/x/mod v0.14.0 // indirect
golang.org/x/net v0.25.0 // indirect
golang.org/x/text v0.15.0 // indirect
golang.org/x/tools v0.15.0 // indirect
google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240318140521-94a12d6c2237 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions internal/hns/hnsendpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ import (
"github.com/sirupsen/logrus"
)

//go:generate stringer -type=EndpointState
//go:generate go run golang.org/x/tools/cmd/stringer -type=EndpointState -output=endpointstate_string_windows.go -trimprefix=EndpointState -tags=windows

// EndpointState represents the states of an HNS Endpoint lifecycle.
type EndpointState uint16

// EndpointState const
// The lifecycle of an Endpoint goes through created, attached, being shared with other containers,
// The lifecycle of an Endpoint goes through created, attached, AttachedSharing - endpoint is being shared with other containers,
// detached, after being attached, degraded and finally destroyed.
const (
Uninitialized EndpointState = iota
Expand Down
3 changes: 3 additions & 0 deletions tools/tools.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,7 @@ import (

// mock gRPC client and servers
_ "go.uber.org/mock/mockgen"

// used in enum to string conversions
_ "golang.org/x/tools/cmd/stringer"
)
Loading

0 comments on commit c193dae

Please sign in to comment.