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

import "runtime" causes "too many errors" #36

Closed
mmullis opened this issue Jul 24, 2017 · 2 comments
Closed

import "runtime" causes "too many errors" #36

mmullis opened this issue Jul 24, 2017 · 2 comments

Comments

@mmullis
Copy link

mmullis commented Jul 24, 2017

Adding import for "runtime" causes too many errors.

Source Code:

package main

import "runtime"
import "github.com/d4l3k/go-pry/pry"

func main() {
  a := 1
  pry.Pry()
}

Result: (note: the undefined runtime.* changes each time)

 # command-line-arguments
./main.go:8: undefined: runtime.REG_RDI
./main.go:8: undefined: runtime.REG_R9
./main.go:8: undefined: runtime.REG_DS
./main.go:8: undefined: runtime.REG_CS
./main.go:8: undefined: runtime.REG_RSI
./main.go:8: undefined: runtime.REG_RCX
./main.go:8: undefined: runtime.REG_R11
./main.go:8: undefined: runtime.REG_RBX
./main.go:8: undefined: runtime.REG_RAX
./main.go:8: undefined: runtime.REG_GS
./main.go:8: too many errors
Reverting files
@d4l3k
Copy link
Owner

d4l3k commented Jul 24, 2017

That's likely caused by different build tags being used in the runtime package since those look like platform specific registers.

It probably randomizes since it's generated via map iteration which is pseudo random.

@mmullis
Copy link
Author

mmullis commented Jul 25, 2017

Looks good. Thanks!
Couldn't quite figure out how to make a correct test case so here's a manual test session for reference:

    10: func main() {
    11:   goos := runtime.GOOS
    12:   goarch := runtime.GOARCH
    13:   maxprocs := runtime.GOMAXPROCS(0)
    14:   fmt.Println("%s %s %d",goos, goarch, maxprocs)
 => 15:   pry.Pry()
    16:   fmt.Println("Done?")
    17: }
    18: 

[17] go-pry> goos 
=> "darwin"
[1] go-pry> goarch 
=> "amd64"
[2] go-pry> maxprocs 
=> 8
[3] go-pry> runtime.GOROOT() 
=> "/usr/local/Cellar/go/1.8.3/libexec"
[4] go-pry> runtime.GOMAXPROCS(1) 
=> 8
[21] go-pry> runtime.GOMAXPROCS(0) 
=> 1

@mmullis mmullis closed this as completed Aug 7, 2017
d4l3k added a commit that referenced this issue Aug 7, 2017
d4l3k added a commit that referenced this issue Aug 7, 2017
Respect build constraints on files. Fixes #36
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