I have a small program that consists of three files, all belonging to the same package (main). But when I do go build main.go
the build doesn't succeed. When it was just one file (main.go
), everything worked fine.
Now that I took some effort to separate the code, it looks like the compiler is unable to find the stuff that was taken out of main.go
and put into these two other files (that reside in the same directory as the main.go). Which results in undefined 'type'
errors.
How to compile this program that consists of multiple files?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…