Move prototype 69-dagger-archon to top-level
Signed-off-by: Solomon Hykes <sh.github.6811@hykes.org>
This commit is contained in:
43
main.go
Normal file
43
main.go
Normal file
@@ -0,0 +1,43 @@
|
||||
// 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)
|
||||
}
|
Reference in New Issue
Block a user