Hi to everyone, I’m a newbie with go. I’m using go with eclipse.
Does anyone know how to build and run a project in Eclipse with two files? I’ve created a first file with a function for test and a second file with a definition of an array of struct. They are in the same src and in the same package.
First file:
import ( "math" "testing")
func TestData(t *testing.T) {
const precision = 0.01
for _, tc := range testExamples {
actual := DataTest(tc.FirstValue, tc.SecondValue)
if ... {
t.Fatalf("FAIL: %s\nExpected: %#v\nActual: %#v", tc.description, tc.expected, actual)
}
t.Logf("PASS: %s", tc.description)
}
}
Second File:
var testCases = []struct {
description string
valuex string
valuey string
expected float64
}{
{
description: "example1",
FirstValue: xxxxx,
SecondValue: yyyyy,
expected: 10,
},{
description: "example2",
FirstValue: xxxxx,
SecondValue: yyyyy,
expected: 280,
}
}
Eclipse, in the first file, report: undefined: testCases
I thought the problem was related to the automatic compilation that does not take into account the 2 files. Does anyone have any suggestions?
Thanks