In /etc/profile I have:

export PATH=$PATH:/usr/local/go/bin
export GOPATH=$HOME/work
export GOROOT=/usr/local/go

I have 2 source files: test.go (main) and second.go They located in

/home/u001/work/src/github.com/user/test/

When I'm running go run test.go from test it gives me:

test.go:5:2: open /home/u001/work/src/github.com/user/test/second: no such file 
or directory


Content of test.go:

package second

import "fmt"

var x int
var y int

func init() {
    x = 44
    y = 100
}

func ShowXY() {
    fmt.Printf("X:%d;Y%d.",x,y)
}


Content of second.go:

package second

import "fmt"

var x int
var y int

func init() {
    x = 44
    y = 100
}

func ShowXY() {
    fmt.Printf("X:%d;Y%d.",x,y)
}


How to be if two source files are in one folder, let's say they both in ~/. 
It works when I had second.go in second/ and changed line to ../second. 
In the book "The Way to Go", listing 4.7 - it is said that in example below 
package is imported from the same directory.
package main
import (
“fmt”
“./trans”
)
var twoPi = 2 * trans.Pi
func main() {
fmt.Printf(“2*Pi = %g\n”, twoPi) // 2*Pi = 6.283185307179586
}





-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to