Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Too slow for vscode after upgrading to 1.11 #49

Open
lucastheisen opened this issue Sep 20, 2018 · 2 comments
Open

Too slow for vscode after upgrading to 1.11 #49

lucastheisen opened this issue Sep 20, 2018 · 2 comments

Comments

@lucastheisen
Copy link

I just upgraded to go 1.11, and now running goreturns takes more than the allowed 750 milliseconds:

PS C:\Users\ltheisen\git\caasd-pd-cli> (Measure-Command { goreturns -w .\cmd\build.go }).TotalSeconds
0.883458

By comparison, gofmt takes little over a tenth of a second:

PS C:\Users\ltheisen\git\caasd-pd-cli> (Measure-Command { gofmt -w .\cmd\build.go }).TotalSeconds
0.1115598

This is for a very simple file containing a single import:

package cmd

import (
	"fmt"

	"github.com/spf13/cobra"
)

func init() {
	rootCmd.AddCommand(buildCmd)
}

var buildCmd = &cobra.Command{
	Use:   "build",
	Short: "Build one or more containers",
	Run: func(cmd *cobra.Command, args []string) {
		fmt.Print("not yet implemented")
	},
}

I'm currently running go version go1.11 windows/amd64.

@lucastheisen
Copy link
Author

Might be related to this issue, but not sure if this project uses goimports or just implements similar features...

@sqs
Copy link
Owner

sqs commented Nov 14, 2018

This is because goreturns must typecheck, but goimports and gofmt only need to parse. It needs to typecheck because a statement like return foo() could be returning a single value or multiple values, depending on whether foo returns a single value or multiple values. That's a rare case, and I am considering just making it not fix any return f() statements. That would eliminate the need to typecheck.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants