This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
dagger/main.go
Solomon Hykes 30f75da114 Move prototype 69-dagger-archon to top-level
Signed-off-by: Solomon Hykes <sh.github.6811@hykes.org>
2020-12-29 18:45:16 -08:00

44 lines
723 B
Go

// A simple main.go for testing the dagger Go API
package main
import (
"context"
"fmt"
"os"
"dagger.cloud/go/dagger"
)
func main() {
ctx := context.TODO()
c, err := dagger.NewClient(ctx, "")
if err != nil {
fatal(err)
}
configPath := "."
if len(os.Args) > 1 {
configPath = os.Args[1]
}
if err := c.SetConfig(configPath); err != nil {
fatal(err)
}
// if err := c.ConnectInput("source", os.Getenv("HOME")+"/Documents/github/samalba/hello-go"); err != nil {
// fatal(err)
// }
if err := c.Run(ctx, "compute"); err != nil {
fatal(err)
}
}
func fatalf(msg string, args ...interface{}) {
fmt.Fprintf(os.Stderr, msg, args...)
os.Exit(1)
}
func fatal(msg interface{}) {
fatalf("%s\n", msg)
}