It's only going to compile/link packages which are referenced by an 
"import" statement (recursively).

On Saturday 17 August 2024 at 10:36:11 UTC+6 Tong Sun wrote:

> Hi,
>
> when providing a lib/module, would sample code under the `examples` folder 
> be considered/linked as part of the module? I guess Go linker would be 
> smart enough to not include them, as they all have their own `func main()` 
> in them, but just want to clarify / confirm. 
>
> I remember seeing one lib/module, which, in order not to let the examples 
> affect the module package size, even put the `examples` folder under 
> `internal/`.
>
> All in all, what's the idiomatic way for Go modules to provide 
> usage examples, everything under the same `examples` folder, or 
> different packages having their own `examples` folders, or other ways? thx.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/8d4c2b30-ad9d-4eab-9682-8987ba8b9154n%40googlegroups.com.

Reply via email to