[go-nuts] packages.Load() for packages with genrule to generate code

2023-07-16 Thread 'Sarita Singh' via golang-nuts
I am getting errors in packages.Load() when passes a packgae whose BUILD.bazel file has genrule to autogenerate code in some other location. The genrule is like: genrule( name = "copy_files", srcs = [ "@someplace//:files", ], outs = [ "x.json", "y.json",

Re: [go-nuts] map type conversion

2023-07-16 Thread Kurtis Rader
It does work (i.e., compiles) if you use a type alias (note the equal sign): type uintXXX = uint Whether it is a good idea to allow it to work using two distinct types that have the same underlying type is debatable. Personally, I think the current behavior (not allowing the conversion) is pr

Re: [go-nuts] map type conversion

2023-07-16 Thread Jan Mercl
On Sun, Jul 16, 2023 at 6:02 PM Leonard Mittmann wrote: > Hi everyone, I am wondering if there is efficient way to do the following > type conversion (without looping over the map): > > var m = map[uint]uint{ /*...*/ } > type uintXXX uint > // this does not work > var m2 map[uintXXX]uintXXX = (m

[go-nuts] Loading packages which import "C"

2023-07-16 Thread 'Sarita Singh' via golang-nuts
I am trying to build static call graph of go project using cha package. However when there is a go file which imports "C", the packages.Load(cfg, args...) function returns error as it is not able to load such packages. The config struct is: cfg := &packages.Config{ Mode: packages.LoadSynta

[go-nuts] map type conversion

2023-07-16 Thread Leonard Mittmann
Hi everyone, I am wondering if there is efficient way to do the following type conversion (without looping over the map): var m = map[uint]uint{ /*...*/ } type uintXXX uint // this does not work var m2 map[uintXXX]uintXXX = (map[uintXXX]uintXXX)(m) -- You received this message because you are s