Skip to content

proposal: cmd/fix: remove all functionality #73605

Open
@adonovan

Description

@adonovan

(This proposal is the first of a sequence of two; #71859 is the second.)

Background: The go fix subcommand was an important tool during the early days of Go to help early adopters deal with rapid changes, not always compatible, in the evolving language. It currently contains these features:

  • buildtag: remove old-style +build tags.
  • cftype: Fixes initializers and casts of C.*Ref and JNI types
  • context: Change imports of golang.org/x/net/context to context
  • egl: Fixes initializers of EGLDisplay
  • eglconf Fixes initializers of EGLConfig
  • gotypes: Change imports of golang.org/x/tools/go/{exact,types} to go/{constant,types}
  • jni: Fixes initializers of JNI's jobject and subtypes
  • netipv6zone: Adapt element key to IPAddr, UDPAddr or TCPAddr composite literals
  • printerconfigFix: Add element keys to Config composite literals

I think all of these have outlived their usefulness, with the possible exceptions of the first, which could be converted to the analysis framework, and the last, which already has been.

This paves the way for a future proposal to add new functionality to go fix to make it invoke the analysis framework (as vet does), but instead of reporting diagnostics, it would batch-apply safe fixes such as those produced by these analyzers:

  • gofix (which probably wants to be renamed to inline)
  • assign
  • hostport
  • timeformat
  • maprange
  • modernize
  • simplifycompositelit
  • simplifyrange
  • simplifyslice
  • unusedparams

Proposal: We propose to remove all functionality from go fix, so that it simply prints an error message.

Related:

Metadata

Metadata

Assignees

No one assigned

    Labels

    ProposalToolProposalIssues describing a requested change to a Go tool or command-line program.

    Type

    No type

    Projects

    Status

    Active

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions