Skip to content

Commit

Permalink
run go lint using github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinForReal authored and k8s-infra-cherrypick-robot committed May 4, 2023
1 parent 1c49dbd commit b30b0eb
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 12 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ jobs:
uses: actions/setup-go@v4
with:
go-version-file: go.mod
- name: Lint
run: |
make lint
GO111MODULE=off go get github.com/kyoh86/looppointer/cmd/looppointer
$(go env GOPATH)/bin/looppointer ./...
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
version: v1.51.2
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ deploy-cluster:
##@ Tools

LINTER = $(shell pwd)/bin/golangci-lint
LINTER_VERSION = v1.50.1
LINTER_VERSION = v1.51.2
.PHONY: golangci-lint
golangci-lint: ## Download golangci-lint locally if necessary.
@echo "Installing golangci-lint"
Expand Down
4 changes: 2 additions & 2 deletions pkg/consts/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,10 @@ type Int32BusinessValidator func(*int32) error
// getInt32FromAnnotations parse integer value from annotation and return an reference to int32 object
func extractInt32FromString(val string, businessValidator ...Int32BusinessValidator) (*int32, error) {
val = strings.TrimSpace(val)
errKey := fmt.Errorf("%s value must be a whole number", val)
errKey := fmt.Sprintf("%s value must be a whole number", val)
toInt, err := strconv.ParseInt(val, 10, 32)
if err != nil {
return nil, fmt.Errorf("error value: %w: %v", err, errKey)
return nil, fmt.Errorf("error value: %w: %s", err, errKey)
}
parsedInt := int32(toInt)
for _, validator := range businessValidator {
Expand Down
5 changes: 1 addition & 4 deletions tests/e2e/utils/network_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,7 @@ func GetNextSubnetCIDRs(vnet aznetwork.VirtualNetwork, ipFamily IPFamily) ([]*ne
} else if ipFamily == IPv4 {
vnetCIDRs = append(vnetCIDRs, (*vnet.AddressSpace.AddressPrefixes)[0])
} else {
for i := range *vnet.AddressSpace.AddressPrefixes {
addrPrefix := (*vnet.AddressSpace.AddressPrefixes)[i]
vnetCIDRs = append(vnetCIDRs, addrPrefix)
}
vnetCIDRs = append(vnetCIDRs, *vnet.AddressSpace.AddressPrefixes...)
}

var existSubnets []string
Expand Down

0 comments on commit b30b0eb

Please sign in to comment.