Skip to content

Go module overrides

The --replace flag keeps a dependency’s name and takes its code from elsewhere, e.g. to source a dependency from a fork, or to pin a version another dependency pulls in.

Terminal window
the name you import
lis add gorilla/mux --replace you/mux
where the code comes from

The replacement is recorded in the manifest:

[dependencies.go]
"github.com/gorilla/mux" = { replacement = "github.com/you/mux@v1.9.0" }

The replacement is transparent to your code:

import "go:github.com/gorilla/mux"

To undo the replacement, re-add the dependency without --replace.

A Lisette project can depend on a Go module located on disk, for local development:

  • Directorymy-lis-app/
    • lisette.toml
    • Directorysrc/
      • main.lis
  • Directorymy-go-app/
    • go.mod module example.com/example/my-go-app
    • main.go

Pass the Go module’s root dir to the --path flag:

Terminal window
cd my-lis-app
lis add --path ../my-go-app

The local Go module is recorded in the manifest:

[dependencies.go]
"example.com/example/my-go-app" = { path = "../my-go-app" }

Import it using the module path in its go.mod:

import "go:example.com/example/my-go-app"

As you edit the local Go module, run lis check in your Lisette project to regenerate the Go module’s typedefs.

Once the Go module is published, use lis add to depend on the published module. Its import path stays the same, so no source changes.