myitcv / gopherjs

A compiler from Go to JavaScript for running Go code in a browser
BSD 2-Clause "Simplified" License
21 stars 0 forks source link

golang_org import doesn't work in GOPATH mode #23

Closed antong closed 5 years ago

antong commented 5 years ago

The stdlib special cased vendored golang_org/... imports do not work in GOPATH mode on the go1.11 branch. In a module it all works. It also works in mainline with the recent Go 1.11 support (0210a2f0f73c96103378b0b935f39868e5731809).

package main                                  

import (                                      
        "fmt"                                 
        _ "crypto/x509"                       
)                                             

func main() {                                 
        fmt.Println("Hello World!")           
}                                             

In a module it works, but in GOPATH it gives:

cannot find package "golang_org/x/crypto/cryptobyte" in any of:
        C:\Users\luser\sw\go\src\golang_org\x\crypto\cryptobyte (from $GOROOT)
        C:\Users\luser\go\src\golang_org\x\crypto\cryptobyte (from $GOPATH)

The stdlib crypto/x509 imports a vendored golang_org/x/crypto/cryptobyte.

myitcv commented 5 years ago

Thanks for the report @antong

This is related to https://github.com/golang/go/issues/26924

I suspect we can fix in GopherJS for now.

myitcv commented 5 years ago

Closing per #37 which confirms everything is now working (likely post #33) in both GOPATH and modules modes.

@antong - please shout if you are still seeing issues.

antong commented 5 years ago

THANK YOU! ... is all I shout :-)