Skip to content
This repository was archived by the owner on Jul 15, 2023. It is now read-only.
This repository was archived by the owner on Jul 15, 2023. It is now read-only.

Need go.formatFlags to support gofmt -s simplify mode #444

Closed

Description

@gbrayut

Our build server enforces the use of gofmt with the simplify mode. Right now I don't see a way to pass the -s flag to the formatting tool in vscode. Can we add a go.formatFlags setting?

Example code for testing:

var final = strings.Split("a b c", " ")
var first = strings.Split("d e f", " ")
final = append(final, first[2:len(first)]...)
//gofmt -s main.go would change the previous line to
final = append(final, first[2:]...)

Activity

  1. lukehoban commented on Aug 21, 2016

    @lukehoban
    Member

    PRs welcome for this. Should be a simple addition modelled after go.buildFlags/go.lintFlags.

  2. added a commit that references this issue on Aug 31, 2016
    3404826
  3. ramya-rao-a commented on Oct 12, 2016

    @ramya-rao-a
    Contributor

    Greg Bray (@gbrayut) Ludwig Valda Vasquez (@bredov) This feature is now available in the latest version of the Go extension : 0.6.44

  4. gbrayut commented on Oct 12, 2016

    @gbrayut
    Author

    Thanks! The following in my settings.json worked exactly as I wanted:

    // Place your settings in this file to overwrite the default settings
    {
        "go.formatTool": "gofmt",
        "go.formatFlags": ["-s", "-e"]
    }
    
  5. locked and limited conversation to collaborators on Jan 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions