Skip to content

fix: invalid use of go's new builtin — will not compile or produces wrong pointer #3228

Description

Description

new(builtinLibs.String()) and new(proxy.String()) are invalid Go. The built-in new() requires a type argument (e.g., new(string)), not a value expression. builtinLibs.String() evaluates to a string value at runtime, so new(...) cannot accept it. This is either a compilation error preventing the package from building, or—if shadowed by some local declaration—it would allocate a zero-valued string instead of the intended value. The project imports go.bug.st/f which provides f.ToPtr() for exactly this purpose.

Severity: critical
File: commands/service_settings.go

Expected Behavior

The code should handle this case properly to avoid unexpected errors or degraded quality.

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: codeRelated to content of the project itselftype: imperfectionPerceived defect in any part of project

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions