thiagola92 / learning-interpreters

0 stars 0 forks source link

Import and include #3

Open thiagola92 opened 5 months ago

thiagola92 commented 5 months ago

Go has this weird way of importing local packages that I don't like it

// External package
my_package "github.com/thiagola92/learning-go/02"

// go mod edit -replace github.com/thiagola92/learning-go/04=../04
// This redirect the URL to the directory 04 in this repository
my_second_package "github.com/thiagola92/learning-go/04"

I would prefer having to keywords for each, for example:

// External package
import "github.com/thiagola92/learning-go/02"

// Local package
include "../04"

What if you intend to publish but didn't finish the package? Use include until you finish.

This means that later I will have to go through the code changing

True, the Go way would make you change in one place only... But I still don't like it.

thiagola92 commented 5 months ago

Actually a package manager holding this type of information sounds more appealing
pkg_manager install ../04
pkg_manager install github.com/thiagola92/learning-go/02