Skip to content

Commit

Permalink
fix launcher go.mod again
Browse files Browse the repository at this point in the history
  • Loading branch information
CAFxX committed May 10, 2023
1 parent 00d9cba commit d7e883f
Show file tree
Hide file tree
Showing 342 changed files with 468 additions and 27 deletions.
5 changes: 2 additions & 3 deletions go.mod
Expand Up @@ -2,9 +2,8 @@ module github.com/CAFxX/mgo

go 1.20

replace github.com/CAFxX/mgo/launcher => ./launcher

require (
github.com/CAFxX/mgo/launcher v0.0.0-00010101000000-000000000000
github.com/klauspost/cpuid/v2 v2.2.4
golang.org/x/mod v0.10.0
golang.org/x/sys v0.8.0
)
5 changes: 5 additions & 0 deletions go.sum
@@ -1,2 +1,7 @@
github.com/klauspost/cpuid/v2 v2.2.4 h1:acbojRNwl3o09bUq+yDCtZFc1aiwaAAxtcn8YkZXnvk=
github.com/klauspost/cpuid/v2 v2.2.4/go.mod h1:RVVoqg1df56z8g3pUjL/3lE5UfnlrJX8tyFgg4nqhuY=
golang.org/x/mod v0.10.0 h1:lFO9qtOdlre5W1jxS3r/4szv2/6iXxScdzjoBMXNhYk=
golang.org/x/mod v0.10.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/sys v0.0.0-20220704084225-05e143d24a9e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU=
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
6 changes: 0 additions & 6 deletions launcher/embed.go

This file was deleted.

8 changes: 0 additions & 8 deletions launcher/go.mod

This file was deleted.

5 changes: 0 additions & 5 deletions launcher/go.sum

This file was deleted.

File renamed without changes.
13 changes: 8 additions & 5 deletions main.go
@@ -1,6 +1,7 @@
package main

import (
"embed"
"fmt"
"io/fs"
"os"
Expand All @@ -10,7 +11,6 @@ import (
"runtime"
"strings"

"github.com/CAFxX/mgo/launcher"
"golang.org/x/mod/semver"
)

Expand Down Expand Up @@ -81,7 +81,7 @@ func main() {
}
defer os.RemoveAll(tmpdir)

err = fs.WalkDir(launcher.Source, ".", func(path string, d fs.DirEntry, err error) error {
err = fs.WalkDir(launcherSource, ".", func(path string, d fs.DirEntry, err error) error {
var dpath string
if a, ok := strings.CutSuffix(path, ".go.mod"); ok {
dpath = a + "go.mod"
Expand All @@ -94,7 +94,7 @@ func main() {
case err != nil:
return err
case d.Type().IsRegular():
buf, err := fs.ReadFile(launcher.Source, path)
buf, err := fs.ReadFile(launcherSource, path)
if err != nil {
return fmt.Errorf("read file %q: %w", path, err)
}
Expand All @@ -119,7 +119,7 @@ func main() {

for _, v := range []string{"v1", "v2", "v3", "v4"} {
cmd := exec.Command("go")
cmd.Args = append([]string{"go", "build", "-o", filepath.Join(tmpdir, "cmd", "mgo."+v)}, args...)
cmd.Args = append([]string{"go", "build", "-o", filepath.Join(tmpdir, "launcher", "mgo."+v)}, args...)
cmd.Env = append(os.Environ(), "GOAMD64="+v)
cmd.Stdin = os.Stdin
cmd.Stdout = os.Stdout
Expand All @@ -132,7 +132,7 @@ func main() {
}

cmd = exec.Command("go")
cmd.Args = []string{"go", "build", "-C", tmpdir, "-mod", "vendor", "-o", filepath.Join(cwd, o), "-trimpath", "./cmd"}
cmd.Args = []string{"go", "build", "-C", tmpdir, "-mod", "vendor", "-o", filepath.Join(cwd, o), "-trimpath", "./launcher"}
cmd.Stdin = os.Stdin
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
Expand All @@ -142,3 +142,6 @@ func main() {
os.Exit(2)
}
}

//go:embed go.mod go.sum launcher vendor
var launcherSource embed.FS
File renamed without changes.
File renamed without changes.

0 comments on commit d7e883f

Please sign in to comment.