Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I make go find my package?

Tags:

go

Where should I put my package so that it can be imported by another package?

$ tree
.
├── main.go
└── src
    └── test.go

1 directory, 2 files

$ cat src/test.go 
package test

$ cat main.go 
package main

import "test"

$ go build main.go 
main.go:3:8: import "test": cannot find package
like image 878
August Karlstrom Avatar asked May 15 '12 12:05

August Karlstrom


People also ask

Is there a way to find out exactly where my package is?

Using the service you can track the location of a sent package on Google Maps. The service currently works for packages sent by FedEx, UPS, TNT and DHL. To track a package you just have to enter the package's tracking number. You are then presented with a Google Map that shows the current location of your package.

Can I call USPS to see where my package is?

You may call this phone number to obtain additional information on USPS Text Tracking: 1-800-222-1811.

What can I do if USPS loses my package?

You can report a missing USPS package by filing a claim at the USPS claims site. The sender or receiver of a USPS package can file a claim, but the original purchase receipt must be available. You can receive a refund for mail that is lost or never delivered to its final destination as long as the package is insured.


1 Answers

Set your GOPATH. Put your package foo source(s) in GOPATH/src/optional-whatever/foo/*.go and use it in code as

import "optional-whatever/foo"

You don't need to explicitly install foo, the go tool is a build tool, it will do that automagically for you whenever necessary.

like image 67
zzzz Avatar answered Nov 13 '22 19:11

zzzz