This directory contains examples of how to use the aliaser
library and CLI.
The main.go
file contains a simple example of how to use
the aliaser
library to generate aliases for github.com/gin-gonic/gin
package.
import (
"log"
"github.com/marcozac/go-aliaser"
)
func main() {
a, err := aliaser.New(&aliaser.Config{TargetPackage: "gin", Pattern: "github.com/gin-gonic/gin"})
if err != nil {
log.Fatal(err)
}
if err := a.GenerateFile("gin/alias.go"); err != nil {
log.Fatal(err)
}
}
The aliaser-uuid.sh
file contains a simple shell
script that uses the aliaser
CLI to generate aliases for
github.com/google/uuid
package.
go run -mod=mod github.com/marcozac/go-aliaser/cmd/aliaser generate \
--target="uuid" \
--pattern="github.com/google/uuid" \
--file="uuid/alias.go"