import "github.com/egdaemon/eg/runtime/x/wasi/eggolang"
func AutoCompile() eg.OpFn
shorthand for New().AutoCompile()
package main
import (
"context"
"log"
"github.com/egdaemon/eg/runtime/wasi/eg"
"github.com/egdaemon/eg/runtime/x/wasi/eggolang"
)
func main() {
// go build ./... for every module in the working directory.
err := eg.Perform(
context.Background(),
eggolang.AutoCompile(),
)
if err != nil {
log.Fatalln(err)
}
}
func AutoInstall() eg.OpFn
shorthand for New().AutoInstall()
package main
import (
"context"
"log"
"github.com/egdaemon/eg/runtime/wasi/eg"
"github.com/egdaemon/eg/runtime/x/wasi/eggolang"
)
func main() {
// go install ./... for every module in the working directory.
err := eg.Perform(
context.Background(),
eggolang.AutoInstall(),
)
if err != nil {
log.Fatalln(err)
}
}
func AutoTest() eg.OpFn
shorthand for New().AutoTest()
package main
import (
"context"
"log"
"github.com/egdaemon/eg/runtime/wasi/eg"
"github.com/egdaemon/eg/runtime/x/wasi/egcoverage"
"github.com/egdaemon/eg/runtime/x/wasi/eggolang"
)
func main() {
// run the tests for every module in the working directory with the defaults.
err := eg.Perform(
context.Background(),
eggolang.AutoTest(),
egcoverage.Report(eggolang.Coverage()...),
)
if err != nil {
log.Fatalln(err)
}
}
func CacheBuildDirectory() string
func CacheDirectory(dirs ...string) string
func CacheModuleDirectory() string
func Coverage() coverage.Options
Coverage is the coverage of the profiles AutoTest wrote, with paths relative to the workspace. it is recorded with egcoverage.Report.
func Env() []string
attempt to build the golang environment that sets up the golang environment for caching.
package main
import (
"fmt"
"os"
_eg "github.com/egdaemon/eg"
"github.com/egdaemon/eg/internal/envx"
"github.com/egdaemon/eg/runtime/x/wasi/eggolang"
)
func main() {
os.Setenv("CACHE_DIRECTORY", "/cache")
os.Setenv(_eg.EnvComputeCacheDirectory, "/cache")
// the process environment is inherited, the cache directories are set last so they take precedence.
effective := envx.NewEnvironFromStrings(eggolang.Env()...)
fmt.Println("GOCACHE", effective.String("", "GOCACHE"))
fmt.Println("GOMODCACHE", effective.String("", "GOMODCACHE"))
}
GOCACHE /cache/.eg/golang/build
GOMODCACHE /cache/.eg/golang/mod
func Runtime() shell.Command
Create a shell runtime that properly sets up the golang environment for caching.