1
0
mirror of https://github.com/juanfont/headscale.git synced 2026-02-07 20:04:00 +01:00

all: add remaining noinlineerr nolint directives

Add nolint:noinlineerr to remaining inline error handling patterns:
- hscontrol/noise.go: writer.Write and json.Unmarshal
- hscontrol/platform_config.go: template.Execute
- hscontrol/tailsql.go: tsNode.Up
- integration/scenario.go: Headscale() calls in CreatePreAuthKey/CreateUser

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Kristoffer Dalby 2026-02-06 12:29:17 +00:00
parent d2aca10195
commit cf3742b608
4 changed files with 6 additions and 6 deletions

View File

@ -153,7 +153,7 @@ func (ns *noiseServer) earlyNoise(protocolVersion int, writer io.Writer) error {
return err
}
if _, err := writer.Write(earlyJSON); err != nil {
if _, err := writer.Write(earlyJSON); err != nil { //nolint:noinlineerr
return err
}
@ -205,7 +205,7 @@ func (ns *noiseServer) NoisePollNetMapHandler(
body, _ := io.ReadAll(req.Body)
var mapRequest tailcfg.MapRequest
if err := json.Unmarshal(body, &mapRequest); err != nil {
if err := json.Unmarshal(body, &mapRequest); err != nil { //nolint:noinlineerr
httpError(writer, err)
return
}

View File

@ -94,7 +94,7 @@ func (h *Headscale) ApplePlatformConfig(
}
var content bytes.Buffer
if err := commonTemplate.Execute(&content, config); err != nil {
if err := commonTemplate.Execute(&content, config); err != nil { //nolint:noinlineerr
httpError(writer, err)
return
}

View File

@ -54,7 +54,7 @@ func runTailSQLService(ctx context.Context, logf logger.Logf, stateDir, dbPath s
// Make sure the Tailscale node starts up. It might not, if it is a new node
// and the user did not provide an auth key.
if st, err := tsNode.Up(ctx); err != nil {
if st, err := tsNode.Up(ctx); err != nil { //nolint:noinlineerr
return fmt.Errorf("starting tailscale: %w", err)
} else {
logf("tailscale started, node state %q", st.BackendState)

View File

@ -480,7 +480,7 @@ func (s *Scenario) CreatePreAuthKey(
reusable bool,
ephemeral bool,
) (*v1.PreAuthKey, error) {
if headscale, err := s.Headscale(); err == nil {
if headscale, err := s.Headscale(); err == nil { //nolint:noinlineerr
key, err := headscale.CreateAuthKey(user, reusable, ephemeral)
if err != nil {
return nil, fmt.Errorf("creating user: %w", err)
@ -532,7 +532,7 @@ func (s *Scenario) CreatePreAuthKeyWithTags(
// CreateUser creates a User to be created in the
// Headscale instance on behalf of the Scenario.
func (s *Scenario) CreateUser(user string) (*v1.User, error) {
if headscale, err := s.Headscale(); err == nil {
if headscale, err := s.Headscale(); err == nil { //nolint:noinlineerr
u, err := headscale.CreateUser(user)
if err != nil {
return nil, fmt.Errorf("creating user: %w", err)