LoginSignup
9
7

More than 5 years have passed since last update.

ファイル分割したmain package内の呼び出しができなかった

Last updated at Posted at 2015-09-20
hoge.go
package main

type Hoge struck{}

main.go
package main

main func() {
  hoge := &Hoge{}
}

go build ./main.go

するとエラー

解決方法

go build

buildをファイル指定で行うと、そのファイルに記載されたファイルの依存解決しかしてくれないんですね。
引数無しなら、ディレクトリ内やパッケージ内のファイルをすべて読みにいってくれると。

参考

Golang undefined variable

9
7
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
9
7