twitchtv / twirp

A simple RPC framework with protobuf service definitions
https://twitchtv.github.io/twirp/docs/intro.html
Apache License 2.0
7.21k stars 326 forks source link

Update best practices to workaround "use of internal package ... not allowed" #183

Closed gurre closed 5 years ago

gurre commented 5 years ago

I'm unable to structure my project using latest Go as suggested in the best practices section Folder/Package Structure. https://twitchtv.github.io/twirp/docs/best_practices.html

On how to use internal packages:

Code in or below a directory named "internal" is importable only by code in the directory tree rooted at the parent of "internal". https://golang.org/cmd/go/#hdr-Internal_Directories

It seems like the parent directory of internal is missing go code and is therefore ignored.

spenczar commented 5 years ago

Hi @gurre, I don't understand. I have projects which use internal directories whose parents have no go code, and it works.

Can you give more detail on the setup that is producing problems for you? A full reproducer would be helpful.

gurre commented 5 years ago

I'm having trouble to reproduce this issue locally. It was created by https://github.com/golangci/golangci-lint/blob/master/pkg/golinters/typecheck.go on circleci running image circleci/golang:1.12. I don't have time to dig further into this issue and since it's not even the go compiler complaining it's not that severe.