/etc/profile I have:test.go (main) and second.go They located in/home/u001/work/src/github.com/user/test/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)
}
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)
}
~/. It works when I had second.go in second/ and changed line to ../second. package main
import (
“fmt”
“./trans”
)
var twoPi = 2 * trans.Pi
func main() {
fmt.Printf(“2*Pi = %g\n”, twoPi) // 2*Pi = 6.283185307179586
}
Thanks.
Just in case - this is what I meant for second.go:
package main
import "./second"
func main(){
second.ShowXY();
}
--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
--
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...@googlegroups.com.
" don't use relative imports like the one you posted from the "The Way to Go", that is't really what you are supposed to do. "Why?What is the difference with "you are supposed to do"? what is the behavior of using the dot?
In other worlds, like NodeJS, it's very common to have local code consumed in that way. And it is independent of any package directory structure.
Angel "Java" Lopez@ajlopez
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.