Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Go Win: can't find import "http"

Tags:

http

windows

go

I downloaded Go for Windows (go.weekly.2012-01-27.windows-amd64.tar.gz), set the environment variables

GOOS=windows
GOROOT=c:\go
GOBIN=c:\go\bin
GOARCH=386

and was able to create a HelloWorld.exe. Now I've tried a very simple example that imports "http", but it doesn't find it. Do I need goinstall or add sth. to the PATH?

like image 778
user414873 Avatar asked Mar 15 '12 09:03

user414873


People also ask

How do I install Go imports?

goimports If your project does not have goimports, click the go get goimports link in the Goimports file notification window. Otherwise, open the Terminal tool window (View | Tool Windows | Terminal), and type the following command to install goimports: go get golang.org/x/tools/cmd/goimports . Press Enter .

How do I import a folder into go?

Create a file basic.go inside the basic folder. The file inside the basic folder should start with the line package basic as it belongs to the basic package. Create a file gross.go inside the gross folder. The file inside the gross folder should start with the line package gross as it belongs to the gross package.

How do I use local library in Golang?

Golang Import Local PackagesIn the root of your project, aka, the workspace directory, create a main.go file. In the example above, we add 3 import clauses to import all the packages in our program. Once imported, we can use the exported code in the packages.


1 Answers

import "net/http" // was "http" in r60 IIRC

like image 149
zzzz Avatar answered Sep 19 '22 19:09

zzzz