http - imported but undefined? Go -
i want use "http" package, , try import
package main import ( "http" ) func main() { resp, err := http.get("https://api.github.com/repos/otiai10/myfirstgo") if err != nil { // } if resp != nil { // } } and got outputs below
% go run httpget.go # command-line-arguments ./httpget.go:4: imported , not used: "http" ./httpget.go:8: undefined: http i saw question : strange golang package import issue
is same problem? or did use 'import' or 'http' in wrong way?
the package want import called "net/http", not "http". try:
import ( "net/http" )
Comments
Post a Comment