lundi 2 décembre 2019

Can't access a private method in the same pacakge for testing

I have 2 files in the same package.

# my_package1/my_file1.go

func myFunc1() {
  //....
} 

# my_package1/my_file1_test.go

type MyPackageSuite struct {
  suite.Suite
}

func (s *MyPackageSuite) MyTest1() {
  //...............

  res1 := myFunc1()

  //...............
} 

I run a test go test my_package1/my_file1_test.go -v and it returns undefined: myFunc1

But they're in the same package. Why the error? How to fix it? Making the method public isn't what I'm looking for.

Aucun commentaire:

Enregistrer un commentaire