mirror of
https://github.com/psviderski/uncloud.git
synced 2026-08-26 11:03:34 +00:00
refactor: manually modernize Go (#349)
Signed-off-by: Miek Gieben <miek@miek.nl>
This commit is contained in:
@@ -242,8 +242,8 @@ func (c *Controller) writeCaddyfileIfChanged(caddyfile string) error {
|
||||
// caddyfileBody returns the Caddyfile content without its first line, which carries a generation timestamp that
|
||||
// rotates on every regeneration.
|
||||
func caddyfileBody(caddyfile string) string {
|
||||
if i := strings.IndexByte(caddyfile, '\n'); i >= 0 {
|
||||
return caddyfile[i+1:]
|
||||
if _, after, ok := strings.Cut(caddyfile, "\n"); ok {
|
||||
return after
|
||||
}
|
||||
return caddyfile
|
||||
}
|
||||
|
||||
@@ -30,8 +30,7 @@ func TestContainerFingerprint_EqualCoversAllFields(t *testing.T) {
|
||||
assert.True(t, base.Equal(base), "base fingerprint must be equal to itself")
|
||||
|
||||
rt := reflect.TypeOf(base)
|
||||
for i := 0; i < rt.NumField(); i++ {
|
||||
field := rt.Field(i)
|
||||
for field := range rt.Fields() {
|
||||
t.Run(field.Name, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ type MockCaddyfileValidator_Validate_Call struct {
|
||||
// Validate is a helper method to define mock.On call
|
||||
// - ctx context.Context
|
||||
// - caddyfile string
|
||||
func (_e *MockCaddyfileValidator_Expecter) Validate(ctx interface{}, caddyfile interface{}) *MockCaddyfileValidator_Validate_Call {
|
||||
func (_e *MockCaddyfileValidator_Expecter) Validate(ctx any, caddyfile any) *MockCaddyfileValidator_Validate_Call {
|
||||
return &MockCaddyfileValidator_Validate_Call{Call: _e.mock.On("Validate", ctx, caddyfile)}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user