Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/ci-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,20 @@ jobs:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v4
- uses: actions/setup-go@v5
with:
go-version: 1.23
- uses: actions/checkout@v3
go-version: 1.26
- uses: actions/checkout@v4
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
uses: golangci/golangci-lint-action@v7
with:
version: v1.60.3
version: v2.10.1
args: --verbose

test:
strategy:
matrix:
go-version: [1.23]
go-version: [1.26]
platform: [ubuntu-latest, macos-latest]

runs-on: ${{ matrix.platform }}
Expand Down
121 changes: 64 additions & 57 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,72 +1,79 @@
linters-settings:
errcheck:
check-type-assertions: true
goconst:
min-len: 2
min-occurrences: 3
gocritic:
enabled-tags:
- diagnostic
- experimental
- opinionated
- performance
- style
govet:
shadow: true
disable:
- fieldalignment # too strict
version: "2"

run:
timeout: 5m
issues-exit-code: 1

nolintlint:
require-explanation: false
require-specific: true
linters:
disable-all: true
enable:
- bodyclose
# - deadcode
# depguard needs to be reviewed properly and then configured, before
# it can be re-enabled.
# https://github.com/OpenPeeDeeP/depguard#example-configs
# - depguard
- copyloopvar
- dogsled
# - dupl
# correctness
- errcheck
- exhaustive
- goconst
- gocritic
- gofmt
- goimports
- gocyclo
- gosec
- gosimple
- govet
- staticcheck
- ineffassign
- misspell
- mnd
- nolintlint
- nakedret

# bug prevention
- copyloopvar
- bodyclose
- exhaustive
- unparam
- unconvert

# code quality
# - gocyclo # TODO: enable later, need to fix complexity issues
- goconst
- revive
- prealloc
- predeclared
- revive
- staticcheck
# - structcheck
- stylecheck

# security
- gosec

# testing
- thelper
- tparallel
- unconvert
- unparam
# - varcheck

# misc
- misspell
- whitespace
- wsl
- nolintlint
- dogsled

settings:
errcheck:
check-type-assertions: true

goconst:
min-len: 2
min-occurrences: 3

gocyclo:
min-complexity: 15

govet:
enable:
- shadow

revive:
severity: warning

nolintlint:
require-explanation: false
require-specific: true

exclusions:
rules:
# Ginkgo/Gomega test suites use dot-imports by convention; suppress the
# revive dot-imports warning for all test files.
- path: '_test\.go'
linters:
- revive
text: 'dot-imports'
- path: '-auto\.go'
linters:
- errcheck
text: 'Error return value is not checked'
issues:
max-issues-per-linter: 0
max-same-issues: 0
fix: true
exclude:
- "cuddle"

run:
issues-exit-code: 1
timeout: "5m"
fix: false
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

## 🔰 Introduction

_[Cobra](https://cobra.dev/) is an excellent framework for the development of command line applications, but is missing a few features that would make it a bit easier to work with. This package aims to fulfil this purpose, especially in regards to creation of commands, encapsulating commands into a container and providing an export mechanism to re-create cli data in a form that is free from cobra (and indeed sundae) abstractions. The aim of this last aspect to to be able to inject data into the core of an application in a way that removes tight coupling to the `Cobra` framework, which is achieved by representing data only in terms of client defined (native) abstractions.
[Cobra](https://cobra.dev/) is an excellent framework for the development of command line applications, but is missing a few features that would make it a bit easier to work with. This package aims to fulfil this purpose, especially in regards to creation of commands, encapsulating commands into a container and providing an export mechanism to re-create cli data in a form that is free from cobra (and indeed sundae) abstractions. The aim of this last aspect to to be able to inject data into the core of an application in a way that removes tight coupling to the `Cobra` framework, which is achieved by representing data only in terms of client defined (native) abstractions.

## 📚 Usage

Expand Down
4 changes: 2 additions & 2 deletions assist/assist-suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package assist_test
import (
"testing"

. "github.com/onsi/ginkgo/v2" //nolint:revive // ginkgo ok
. "github.com/onsi/gomega" //nolint:revive // gomega ok
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)

func TestAssist(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions assist/cfg/cfg-suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package cfg_test
import (
"testing"

. "github.com/onsi/ginkgo/v2" //nolint:revive // ginkgo ok
. "github.com/onsi/gomega" //nolint:revive // gomega ok
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)

func TestCfg(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions assist/cfg/global-config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"path/filepath"
"time"

. "github.com/onsi/ginkgo/v2" //nolint:revive // ginkgo ok
. "github.com/onsi/gomega" //nolint:revive // gomega ok
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/spf13/viper"
"go.uber.org/mock/gomock"

Expand Down
4 changes: 2 additions & 2 deletions assist/clif/clif-suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package clif_test
import (
"testing"

. "github.com/onsi/ginkgo/v2" //nolint:revive // ginkgo ok
. "github.com/onsi/gomega" //nolint:revive // gomega ok
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)

func TestClif(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions assist/clif/evaluate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package clif_test
import (
"fmt"

. "github.com/onsi/ginkgo/v2" //nolint:revive // ginkgo ok
. "github.com/onsi/gomega" //nolint:revive // gomega ok
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

"github.com/snivilised/sundae/assist/clif"
)
Expand Down
4 changes: 2 additions & 2 deletions assist/clif/expand_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package clif_test
import (
"fmt"

. "github.com/onsi/ginkgo/v2" //nolint:revive // ginkgo ok
. "github.com/onsi/gomega" //nolint:revive // gomega ok
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

"github.com/snivilised/sundae/assist/clif"
)
Expand Down
40 changes: 0 additions & 40 deletions assist/param-set-data_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package assist_test

import (
"fmt"
"net"
"time"

Expand Down Expand Up @@ -65,42 +64,3 @@ type WidgetParameterSet struct {
}

type InvalidParameterSet string

func duration(d string) time.Duration {
result, _ := time.ParseDuration(d)
return result
}

func ipmask(v string) net.IPMask {
var result net.IPMask

switch v {
case "default":
result = net.IPMask([]byte{0, 0, 0, 0})

case "orion.net":
result = net.IPMask([]byte{255, 255, 255, 0})

default:
panic(fmt.Errorf("no ipmask defined for: '%v'", v))
}

return result
}

func ipnet(v string) net.IPNet {
var result net.IPNet

switch v {
case "default":
result = net.IPNet{IP: net.IPv4(0, 0, 0, 0), Mask: ipmask(v)}

case "orion.net":
result = net.IPNet{IP: net.IPv4(172, 16, 0, 0), Mask: ipmask(v)}

default:
panic(fmt.Errorf("no ipnet defined for: '%v'", v))
}

return result
}
4 changes: 2 additions & 2 deletions assist/param-set_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package assist_test
import (
"fmt"

. "github.com/onsi/ginkgo/v2" //nolint:revive // ginkgo ok
. "github.com/onsi/gomega" //nolint:revive // gomega ok
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/snivilised/sundae/assist"
"github.com/snivilised/sundae/internal/lab"
"github.com/spf13/cobra"
Expand Down
60 changes: 28 additions & 32 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,48 +1,44 @@
module github.com/snivilised/sundae

go 1.23.0
go 1.26.0

require (
github.com/nicksnyder/go-i18n/v2 v2.6.0
github.com/onsi/ginkgo/v2 v2.23.4
github.com/onsi/gomega v1.36.3
github.com/snivilised/li18ngo v0.1.9
github.com/spf13/pflag v1.0.6
github.com/nicksnyder/go-i18n/v2 v2.6.1
github.com/onsi/ginkgo/v2 v2.28.1
github.com/onsi/gomega v1.39.1
github.com/snivilised/li18ngo v0.1.10
github.com/spf13/pflag v1.0.10
)

require (
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/Masterminds/semver/v3 v3.4.0 // indirect
github.com/fsnotify/fsnotify v1.9.0 // indirect
github.com/go-viper/mapstructure/v2 v2.5.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/pelletier/go-toml/v2 v2.2.2 // indirect
github.com/sagikazarmark/locafero v0.4.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
github.com/sourcegraph/conc v0.3.0 // indirect
github.com/spf13/afero v1.11.0 // indirect
github.com/spf13/cast v1.6.0 // indirect
github.com/pelletier/go-toml/v2 v2.2.4 // indirect
github.com/sagikazarmark/locafero v0.12.0 // indirect
github.com/spf13/afero v1.15.0 // indirect
github.com/spf13/cast v1.10.0 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
go.uber.org/atomic v1.9.0 // indirect
go.uber.org/automaxprocs v1.6.0 // indirect
go.uber.org/multierr v1.9.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
go.yaml.in/yaml/v3 v3.0.4 // indirect
golang.org/x/mod v0.34.0 // indirect
golang.org/x/sync v0.20.0 // indirect
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect
)

require (
github.com/go-logr/logr v1.4.2 // indirect
github.com/go-logr/logr v1.4.3 // indirect
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
github.com/google/go-cmp v0.7.0 // indirect
github.com/google/pprof v0.0.0-20250403155104-27863c87afa6 // indirect
github.com/google/pprof v0.0.0-20260302011040-a15ffb7f9dcc // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/snivilised/nefilim v0.1.10 // indirect
github.com/spf13/cobra v1.8.1
github.com/spf13/viper v1.19.0
go.uber.org/mock v0.5.0
golang.org/x/exp v0.0.0-20241108190413-2d47ceb2692f
golang.org/x/net v0.37.0 // indirect
golang.org/x/sys v0.32.0 // indirect
golang.org/x/text v0.24.0
golang.org/x/tools v0.31.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
github.com/snivilised/nefilim v0.1.11 // indirect
github.com/spf13/cobra v1.10.2
github.com/spf13/viper v1.21.0
go.uber.org/mock v0.6.0
golang.org/x/exp v0.0.0-20260218203240-3dfff04db8fa
golang.org/x/net v0.51.0 // indirect
golang.org/x/sys v0.42.0 // indirect
golang.org/x/text v0.35.0
golang.org/x/tools v0.42.0 // indirect
)
Loading
Loading