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

bitflags command - run from command line or //go:generate fails. #2

Closed
davegi opened this issue Nov 21, 2023 · 3 comments
Closed

bitflags command - run from command line or //go:generate fails. #2

davegi opened this issue Nov 21, 2023 · 3 comments

Comments

@davegi
Copy link

davegi commented Nov 21, 2023

From the command line:

E:\repos\nantucket>bitflags --help

  Usage: C:\Users\davegi\go\bin\bitflags.exe [options] [file] [file] ...


      bitflags [flags] -type T [directory]
      bitflags [flags] -type T files... # Must be a single package

  For more information, see:

      https://github.com/flier/go-bitflags/cmd/bitflags

  package directory or a list of files

  Options:
  --type, -t          list of type names (allows multiple)
  --output, -o        output file name; default srcdir/<type>_bitflags.go
  --trim-prefix       trim the 'prefix' from the generated constant names
  --line-comment, -l  use line comment text as printed text when present
  --tag               list of build tags to apply (allows multiple)
  --help, -h          display help

  Author:
    Flier Lu <[email protected]>

  Read more:
    https://github.com/flier/go-bitflags


E:\repos\nantucket>bitflags -t Pill
2023/11/21 13:33:08 internal error: package "github.com/davegi/nantucket/cmd" without types was imported from "github.com/davegi/nantucket"

E:\repos\nantucket>

Or from GO code (in VS Code):

type Pill int

const (
	Placebo Pill = 1 << iota
	Aspirin
	Ibuprofen
	Paracetamol
	Acetaminophen = Paracetamol
)

//go:generate bitflags --type=Pill

Yields:

[Info  - 1:40:06 PM] 2023/11/21 13:40:06 bitflags --type=Pill

	operation="generate"

[Info  - 1:40:06 PM] 2023/11/21 13:40:06 2023/11/21 13:40:06 internal error: package "context" without types was imported from "github.com/davegi/nantucket/cmd"

	operation="generate"

[Info  - 1:40:06 PM] 2023/11/21 13:40:06 console.go:25: running "bitflags": exit status 1

	operation="generate"

[Error - 1:40:06 PM] 2023/11/21 13:40:06 command error: exit status 1

[Error - 1:40:06 PM] Request workspace/executeCommand failed.
  Message: exit status 1
@davegi
Copy link
Author

davegi commented Nov 22, 2023

More details...chokes on "fmt" package⁉️
image

@kedars
Copy link

kedars commented Dec 28, 2023

I see similar error go version 1.21.5

@flier
Copy link
Owner

flier commented Feb 20, 2024

it seems caused by golang/go#62167, let's upgrade golang.org/x/tools/go/packages

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

3 participants