Go language: Using package name inside package scope (for Examples) -
I am currently writing Now, I get two benefits from this: One thing bothers me And I wonder if I should have done anything about it. For the user trying to learn from this example, line should really be But since the package is in the same area as a package, I can not use it this way. So I think the disturbing version of my question will be: Is there a way to allow Thanks Incidentally, this causes you to write for your test cases (at least for this file) only for public APIs. This is often a good thing but if you have to write in personal work , You can split your test into separate files, some in the BTW, documentation for this is a little buried in the "Test package" section. exampleFuncs in my Go Test Script for example:
go test and
func GetSymbol
data: = GetSymbol ("AAPL")
Data: Hello = Hello Gate Simbol ("AAPL")
package.field notation inside the package?
Hello Put it in the package,
hello_test . You have permission for both
Hello and
Hello_Test packages in the same directory, and this allows you to create the way you are suggesting your examples (required) .
Hello package and some
hello_test .
Comments
Post a Comment