Skip to content

Commit a059a46

Browse files
committed
feat: add core sundae functionality (#4)
1 parent 4d598bd commit a059a46

Some content is hidden

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

58 files changed

+6822
-61
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,6 @@ i18n/out/en-US/active.en-GB.json
2828
.DS_Store
2929
thumbs.db
3030
.tmp
31+
32+
go.work
33+
go.work.sum

.golangci.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ linters:
2020
- unconvert
2121

2222
# code quality
23-
# - gocyclo # TODO: enable later, need to fix complexity issues
23+
- gocyclo
2424
- goconst
2525
- revive
2626
- prealloc
@@ -69,6 +69,11 @@ linters:
6969
linters:
7070
- revive
7171
text: 'dot-imports'
72+
# errcheck: We need to temporarily disable checking of auto generated
73+
# code, until the new generator has been created
74+
- path: '-auto\.go'
75+
linters:
76+
- errcheck
7277

7378
issues:
7479
max-issues-per-linter: 0

.vscode/launch.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@
44
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
55
"version": "0.2.0",
66
"configurations": [
7+
{
8+
"name": "Debug Ginkgo",
9+
"type": "go",
10+
"request": "launch",
11+
"mode": "test",
12+
"program": "${fileDirname}",
13+
"args": ["-ginkgo.v"]
14+
},
715
{
816
"name": "Launch Package",
917
"type": "go",

.vscode/settings.json

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44
"--fast"
55
],
66
"cSpell.words": [
7-
"mamba",
7+
"afero",
88
"bodyclose",
99
"chzyer",
10+
"clif",
1011
"cmds",
1112
"copyloopvar",
1213
"coverpkg",
@@ -20,6 +21,7 @@
2021
"errcheck",
2122
"exportloopref",
2223
"fieldalignment",
24+
"fsnotify",
2325
"goconst",
2426
"gocritic",
2527
"gocyclo",
@@ -28,18 +30,26 @@
2830
"golangci",
2931
"gomega",
3032
"gomnd",
33+
"gomock",
3134
"goreleaser",
3235
"gosec",
3336
"gosimple",
37+
"gotenv",
3438
"goveralls",
3539
"govet",
3640
"graffico",
3741
"ianlancetaylor",
42+
"inconshreveable",
3843
"ineffassign",
44+
"Infexion",
3945
"jibberjabber",
4046
"linters",
47+
"locafero",
4148
"logr",
49+
"mamba",
50+
"mapstructure",
4251
"mattn",
52+
"mockgen",
4353
"nakedret",
4454
"nefilim",
4555
"nicksnyder",
@@ -49,18 +59,23 @@
4959
"outdir",
5060
"pixa",
5161
"prealloc",
62+
"quantico",
5263
"repotoken",
64+
"sagikazarmark",
5365
"shogo",
5466
"sidewalk",
5567
"snivilised",
68+
"sourcegraph",
5669
"staticcheck",
5770
"structcheck",
5871
"stylecheck",
72+
"subosito",
5973
"thelper",
6074
"toplevel",
6175
"tparallel",
6276
"typecheck",
6377
"unconvert",
78+
"unfocus",
6479
"unparam",
6580
"varcheck",
6681
"watchv",

Taskfile.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ tasks:
5252
cmds:
5353
- ginkgo -v --dry-run ./...
5454

55+
u:
56+
cmds:
57+
- ginkgo unfocus
58+
5559
# === ginkgo ================================================
5660

5761
# initialise a test suite for a package. (only 1 per package)

assist/assist-suite_test.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package assist_test
2+
3+
import (
4+
"testing"
5+
6+
. "github.com/onsi/ginkgo/v2"
7+
. "github.com/onsi/gomega"
8+
)
9+
10+
func TestAssist(t *testing.T) {
11+
RegisterFailHandler(Fail)
12+
RunSpecs(t, "Assist Suite")
13+
}

assist/cfg/cfg-suite_test.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package cfg_test
2+
3+
import (
4+
"testing"
5+
6+
. "github.com/onsi/ginkgo/v2"
7+
. "github.com/onsi/gomega"
8+
)
9+
10+
func TestCfg(t *testing.T) {
11+
RegisterFailHandler(Fail)
12+
RunSpecs(t, "Cfg Suite")
13+
}

assist/cfg/global-config.go

Lines changed: 191 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,191 @@
1+
package cfg
2+
3+
import (
4+
"time"
5+
6+
"github.com/spf13/pflag"
7+
"github.com/spf13/viper"
8+
)
9+
10+
//go:generate mockgen -destination ../mocks/mock-global-viper-config.go -package mocks -source global-config.go -mock_names ViperConfig=MockViperConfig
11+
12+
type ViperConfig interface {
13+
AddConfigPath(in string)
14+
AutomaticEnv()
15+
BindFlagValue(key string, flag viper.FlagValue) error
16+
BindFlagValues(flags viper.FlagValueSet) error
17+
BindPFlag(key string, flag *pflag.Flag) error
18+
ConfigFileUsed() string
19+
Get(key string) interface{}
20+
GetBool(key string) bool
21+
GetDuration(key string) time.Duration
22+
GetFloat64(key string) float64
23+
GetInt(key string) int
24+
GetInt32(key string) int32
25+
GetInt64(key string) int64
26+
GetIntSlice(key string) []int
27+
GetUint(key string) uint
28+
GetUint16(key string) uint16
29+
GetUint32(key string) uint32
30+
GetUint64(key string) uint64
31+
GetTime(key string) time.Time
32+
GetSizeInBytes(key string) uint
33+
GetString(key string) string
34+
GetStringMap(key string) map[string]interface{}
35+
GetStringMapString(key string) map[string]string
36+
GetStringMapStringSlice(key string) map[string][]string
37+
GetStringSlice(key string) []string
38+
InConfig(key string) bool
39+
ReadInConfig() error
40+
SetConfigFile(in string)
41+
SetConfigName(in string)
42+
SetConfigType(in string)
43+
SetTypeByDefaultValue(enable bool)
44+
Sub(key string) *viper.Viper
45+
Unmarshal(rawVal interface{}, opts ...viper.DecoderConfigOption) error
46+
UnmarshalExact(rawVal interface{}, opts ...viper.DecoderConfigOption) error
47+
UnmarshalKey(key string, rawVal interface{}, opts ...viper.DecoderConfigOption) error
48+
}
49+
50+
type GlobalViperConfig struct {
51+
}
52+
53+
func (p *GlobalViperConfig) AddConfigPath(in string) {
54+
viper.AddConfigPath(in)
55+
}
56+
57+
func (p *GlobalViperConfig) AutomaticEnv() {
58+
viper.AutomaticEnv()
59+
}
60+
61+
func (p *GlobalViperConfig) BindFlagValue(key string, flag viper.FlagValue) error {
62+
return viper.BindFlagValue(key, flag)
63+
}
64+
65+
func (p *GlobalViperConfig) BindFlagValues(flags viper.FlagValueSet) error {
66+
return viper.BindFlagValues(flags)
67+
}
68+
69+
func (p *GlobalViperConfig) BindPFlag(key string, flag *pflag.Flag) error {
70+
return viper.BindPFlag(key, flag)
71+
}
72+
73+
func (p *GlobalViperConfig) ConfigFileUsed() string {
74+
return viper.ConfigFileUsed()
75+
}
76+
77+
func (p *GlobalViperConfig) Get(key string) interface{} {
78+
return viper.Get(key)
79+
}
80+
81+
func (p *GlobalViperConfig) GetBool(key string) bool {
82+
return viper.GetBool(key)
83+
}
84+
85+
func (p *GlobalViperConfig) GetDuration(key string) time.Duration {
86+
return viper.GetDuration(key)
87+
}
88+
89+
func (p *GlobalViperConfig) GetFloat64(key string) float64 {
90+
return viper.GetFloat64(key)
91+
}
92+
93+
func (p *GlobalViperConfig) GetInt(key string) int {
94+
return viper.GetInt(key)
95+
}
96+
97+
func (p *GlobalViperConfig) GetInt32(key string) int32 {
98+
return viper.GetInt32(key)
99+
}
100+
101+
func (p *GlobalViperConfig) GetInt64(key string) int64 {
102+
return viper.GetInt64(key)
103+
}
104+
105+
func (p *GlobalViperConfig) GetIntSlice(key string) []int {
106+
return viper.GetIntSlice(key)
107+
}
108+
109+
func (p *GlobalViperConfig) GetUint(key string) uint {
110+
return viper.GetUint(key)
111+
}
112+
113+
func (p *GlobalViperConfig) GetUint16(key string) uint16 {
114+
return viper.GetUint16(key)
115+
}
116+
117+
func (p *GlobalViperConfig) GetUint32(key string) uint32 {
118+
return viper.GetUint32(key)
119+
}
120+
121+
func (p *GlobalViperConfig) GetUint64(key string) uint64 {
122+
return viper.GetUint64(key)
123+
}
124+
125+
func (p *GlobalViperConfig) GetTime(key string) time.Time {
126+
return viper.GetTime(key)
127+
}
128+
129+
func (p *GlobalViperConfig) GetSizeInBytes(key string) uint {
130+
return viper.GetSizeInBytes(key)
131+
}
132+
133+
func (p *GlobalViperConfig) GetString(key string) string {
134+
return viper.GetString(key)
135+
}
136+
137+
func (p *GlobalViperConfig) GetStringMap(key string) map[string]interface{} {
138+
return viper.GetStringMap(key)
139+
}
140+
141+
func (p *GlobalViperConfig) GetStringMapString(key string) map[string]string {
142+
return viper.GetStringMapString(key)
143+
}
144+
145+
func (p *GlobalViperConfig) GetStringMapStringSlice(key string) map[string][]string {
146+
return viper.GetStringMapStringSlice(key)
147+
}
148+
149+
func (p *GlobalViperConfig) GetStringSlice(key string) []string {
150+
return viper.GetStringSlice(key)
151+
}
152+
153+
func (p *GlobalViperConfig) InConfig(key string) bool {
154+
return viper.InConfig(key)
155+
}
156+
157+
func (p *GlobalViperConfig) ReadInConfig() error {
158+
return viper.ReadInConfig()
159+
}
160+
161+
func (p *GlobalViperConfig) SetConfigFile(in string) {
162+
viper.SetConfigFile(in)
163+
}
164+
165+
func (p *GlobalViperConfig) SetConfigName(in string) {
166+
viper.SetConfigName(in)
167+
}
168+
169+
func (p *GlobalViperConfig) SetConfigType(in string) {
170+
viper.SetConfigType(in)
171+
}
172+
173+
func (p *GlobalViperConfig) SetTypeByDefaultValue(enable bool) {
174+
viper.SetTypeByDefaultValue(enable)
175+
}
176+
177+
func (p *GlobalViperConfig) Sub(key string) *viper.Viper {
178+
return viper.Sub(key)
179+
}
180+
181+
func (p *GlobalViperConfig) Unmarshal(rawVal interface{}, opts ...viper.DecoderConfigOption) error {
182+
return viper.Unmarshal(rawVal, opts...)
183+
}
184+
185+
func (p *GlobalViperConfig) UnmarshalExact(rawVal interface{}, opts ...viper.DecoderConfigOption) error {
186+
return viper.UnmarshalExact(rawVal, opts...)
187+
}
188+
189+
func (p *GlobalViperConfig) UnmarshalKey(key string, rawVal interface{}, opts ...viper.DecoderConfigOption) error {
190+
return viper.UnmarshalKey(key, rawVal, opts...)
191+
}

0 commit comments

Comments
 (0)