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

Popular posts from this blog

assembly - 8086 TASM: Illegal Indexing Mode -

Java, LWJGL, OpenGL 1.1, decoding BufferedImage to Bytebuffer and binding to OpenGL across classes -

javascript - addthis share facebook and google+ url -