Answer the question
In order to leave comments, you need to log in
Multi-file Golang project in Intellij IDEA. What about imports?
Good afternoon, faced such problem. Defined struct in another file (package same main), but IDEA with Go plugin ( https://github.com/go-lang-plugin-org/go-lang-idea... ) refuses to start the project.
The project structure is such
a Struct2.go file
package main
type Struct2 struct {
Field2 string
}
package main
import (
"fmt"
)
func main() {
s1 := struct1{field1: "field1"}
fmt.Println(s1)
s2 := Struct2{Field2: "field2"}
fmt.Println(s2)
}
type struct1 struct {
field1 string
}
./main.go:10: undefined: Struct2
Answer the question
In order to leave comments, you need to log in
So I sort of figured it out, thanks to Nikita for suggesting the idea.
Here in the settings there should be a launch type not File but Package
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question