Y
Y
Yuri Dzhur2013-07-26 07:58:27
go
Yuri Dzhur, 2013-07-26 07:58:27

Compilation problem

There are a couple of files at: D:\src\hw
hw.go

package main
import (
  "mix"
)
func main() {
  mix.Dex()
}

mix.go
package mix
import (
  "fmt"
)
func Dex() {
  fmt.Print("Тест")
}


When I try to compile the project (go build hw), I get an error:
can't load package: package hw: found packages main (hw.go) and mix (mix.go) in D:\src\hw

PS GOPATH is registered. Individual files are collected and run.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
DeusModus, 2013-07-26
@qrasik

You cannot create a package that is not in a separate folder.
Correct structure:

PS: Read the docs, everything is written about packages there.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question