diff --git a/.golangci.yml b/.golangci.yml index d3f3f85ac..d8b52277d 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -62,8 +62,6 @@ linters: - fmt.* - (go.uber.org/zap/zapcore.ObjectEncoder).AddObject - (go.uber.org/zap/zapcore.ObjectEncoder).AddArray - exhaustive: - ignore-enum-types: reflect.Kind|svc.Cmd exclusions: generated: lax presets: diff --git a/context.go b/context.go index 7c06d26c0..6c5293f8c 100644 --- a/context.go +++ b/context.go @@ -207,6 +207,8 @@ func (ctx Context) LoadModule(structPointer any, fieldName string) (any, error) var result any + // Unsupported field kinds return an error. + //exhaustive:ignore switch val.Kind() { case reflect.Slice: if isJSONRawMessage(typ) { diff --git a/modules/caddyhttp/responsewriter.go b/modules/caddyhttp/responsewriter.go index 93c6ca787..fa6ebcf4e 100644 --- a/modules/caddyhttp/responsewriter.go +++ b/modules/caddyhttp/responsewriter.go @@ -98,6 +98,8 @@ func UnwrapResponseWriterAs[T any](w http.ResponseWriter) (T, bool) { func responseWriterPointer(w http.ResponseWriter) uintptr { v := reflect.ValueOf(w) + // Only pointer-like kinds have stable identity. + //exhaustive:ignore switch v.Kind() { case reflect.Pointer, reflect.Map, reflect.Chan, reflect.Func, reflect.Slice, reflect.UnsafePointer: if v.IsNil() { diff --git a/service_windows.go b/service_windows.go index 4720dbaa4..97d604d45 100644 --- a/service_windows.go +++ b/service_windows.go @@ -49,6 +49,8 @@ func (runner) Execute(args []string, request <-chan svc.ChangeRequest, status ch for { req := <-request + // Unsupported service controls are ignored. + //exhaustive:ignore switch req.Cmd { case svc.Interrogate: status <- req.CurrentStatus