summaryrefslogtreecommitdiff
path: root/doGoWork.go
blob: ca1700611aae4bbc37824752624507ea18aa7e8d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package main

import (
	"fmt"
	"path/filepath"

	"go.wit.com/lib/env"
	"go.wit.com/lib/gui/shell"
	"go.wit.com/log"
)

func doGoWork() (string, error) {
	if env.True("GoWork") {
		s := fmt.Sprintf("Creating %s", filepath.Join(env.Get("gopath"), "go.work"))
		shell.PathRun(env.Get("gopath"), []string{"mv", "go.work", "go.work.last"})
		err := me.forge.MakeGoWork()
		shell.PathRun(env.Get("gopath"), []string{"go", "work", "use"})
		log.Info("")
		log.Info("original go.work file saved as go.work.last")
		log.Info("")
		return s, err
	}
	return "Not working with a go.work file", nil
}