Skip to content

Commit

Permalink
Merge branch 'main' into c/document-functions
Browse files Browse the repository at this point in the history
  • Loading branch information
bschaatsbergen authored Dec 3, 2023
2 parents dab15f7 + 16180f9 commit 5b4897a
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 7 deletions.
9 changes: 6 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,12 @@ jobs:
uses: actions/setup-go@v4
with:
go-version-file: go.mod
- name: Generate
run: go generate -v ./...
cache: true
- name: Build
run: go build -v ./...
- name: Test
- name: Run linters
uses: golangci/golangci-lint-action@v3
with:
version: latest
- name: Run tests
run: go test -v ./...
38 changes: 38 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Visit https://golangci-lint.run/ for usage documentation and information on other useful linters
issues:
max-per-linter: 0
max-same-issues: 0

exclude-rules:
# disable funlen for test funcs
- source: "^func Test"
linters:
- funlen

linters:
disable-all: true
enable:
- bidichk
- durationcheck
- decorder
- dogsled
- errcheck
- exportloopref
- forcetypeassert
- funlen
- godot
- godox
- gofmt
- gosimple
- goconst
- ineffassign
- makezero
- misspell
- nilerr
- predeclared
- staticcheck
- tenv
- unconvert
- unparam
- unused
- vet
2 changes: 1 addition & 1 deletion cmd/contains.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const (
"cidr contains 10.0.0.0/16 10.0.14.5\n" +
"\n" +
"# Check whether an IPv6 CIDR range contains a given IPv6 address\n" +
"cidr contains 2001:db8:1234:1a00::/106 2001:db8:1234:1a00::\n"
"cidr contains 2001:db8:1234:1a00::/106 2001:db8:1234:1a00::"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion cmd/count.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const (
"cidr count 10.0.0.0/16\n" +
"\n" +
"# Return the count of all distinct host addresses within a given IPv6 CIDR range\n" +
"cidr count 2001:db8:1234:1a00::/106\n"
"cidr count 2001:db8:1234:1a00::/106"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion cmd/overlaps.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const (
"cidr overlaps 10.0.0.0/16 10.0.14.0/22\n" +
"\n" +
"# Check whether 2 IPv6 CIDR ranges overlap\n" +
"cidr overlaps 2001:db8:1111:2222:1::/80 2001:db8:1111:2222:1:1::/96\n"
"cidr overlaps 2001:db8:1111:2222:1::/80 2001:db8:1111:2222:1:1::/96"
)

var overlapsCmd = &cobra.Command{
Expand Down
6 changes: 5 additions & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ var (
Short: "cidr - CLI to perform various actions on CIDR ranges",
Version: version, // The version is set during the build by making using of `go build -ldflags`.
Run: func(cmd *cobra.Command, args []string) {
cmd.Help()
err := cmd.Help()
if err != nil {
fmt.Println(err)
os.Exit(1)
}
},
}
)
Expand Down

0 comments on commit 5b4897a

Please sign in to comment.