just never, never make directories in packages
This commit is contained in:
parent
339c88ccbd
commit
9439051fc6
|
@ -1,46 +0,0 @@
|
|||
VERSION = $(shell git describe --tags)
|
||||
BUILDTIME = $(shell date +%Y.%m.%d)
|
||||
|
||||
build:
|
||||
GO111MODULE=off go build \
|
||||
-ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}"
|
||||
./forgeConfig
|
||||
FORGE_HOME=/tmp/forge ./forgeConfig
|
||||
FORGE_HOME=/tmp/forge ./forgeConfig --list
|
||||
|
||||
install:
|
||||
GO111MODULE=off go install \
|
||||
-ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}"
|
||||
|
||||
test:
|
||||
./forgeConfig --list
|
||||
./forgeConfig --add --gopath 'go.wit.com/apps/foo'
|
||||
./forgeConfig --add --gopath 'go.wit.com/apps/foowrite' --writable
|
||||
./forgeConfig --add --gopath 'gitea.wit.com' --directory
|
||||
./forgeConfig --add --gopath 'git.wit.org' --directory
|
||||
./forgeConfig --delete --gopath 'go.wit.com/apps/helloworld'
|
||||
./forgeConfig --list
|
||||
|
||||
list:
|
||||
./forgeConfig --list
|
||||
|
||||
add:
|
||||
./forgeConfig --add --name 'foo' --gopath 'go.wit.com/apps/foo'
|
||||
|
||||
update:
|
||||
./forgeConfig --update --name 'foo' --gopath 'more stuff but not memory corruption?'
|
||||
|
||||
corruptMemory:
|
||||
./forgeConfig --update --name 'foo' --gopath 'blah'
|
||||
|
||||
goimports:
|
||||
goimports -w *.go
|
||||
|
||||
prep:
|
||||
go get -v -t -u
|
||||
|
||||
run:
|
||||
go run *.go
|
||||
|
||||
clean:
|
||||
-rm -f forgeConfig
|
|
@ -1,50 +0,0 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"os"
|
||||
|
||||
"go.wit.com/dev/alexflint/arg"
|
||||
)
|
||||
|
||||
var argv args
|
||||
|
||||
type args struct {
|
||||
ConfigDir string `arg:"env:FORGE_HOME" help:"defaults to ~/.config/forge/"`
|
||||
List bool `arg:"--list" default:"false" help:"list repos in your config"`
|
||||
Add bool `arg:"--add" default:"false" help:"add a new repo"`
|
||||
Delete bool `arg:"--delete" default:"false" help:"delete a repo"`
|
||||
Update bool `arg:"--update" default:"false" help:"update a repo"`
|
||||
GoPath string `arg:"--gopath" help:"gopath of the repo"`
|
||||
Directory bool `arg:"--directory" default:"false" help:"repo is a directory to match against"`
|
||||
ReadOnly bool `arg:"--readonly" default:"false" help:"repo is readonly"`
|
||||
Writable bool `arg:"--writable" default:"false" help:"repo is writable"`
|
||||
Favorite bool `arg:"--favorite" default:"false" help:"forge will always go-clone or git clone this"`
|
||||
Private bool `arg:"--private" default:"false" help:"repo can not be published"`
|
||||
Interesting bool `arg:"--interesting" default:"false" help:"something you decided was cool"`
|
||||
}
|
||||
|
||||
func (a args) Description() string {
|
||||
return `
|
||||
forgeConfig -- add entries to your config files
|
||||
|
||||
This is just example protobuf code to test forgepb is working
|
||||
but it could be used to automagically create a config file too.
|
||||
|
||||
If you need to change your config file, just edit the forge.text or forge.json
|
||||
files then remove the forge.pb and ConfigLoad() will attempt to load those files instead
|
||||
`
|
||||
}
|
||||
|
||||
func (args) Version() string {
|
||||
return "virtigo " + VERSION
|
||||
}
|
||||
|
||||
func init() {
|
||||
var pp *arg.Parser
|
||||
pp = arg.MustParse(&argv)
|
||||
|
||||
if pp == nil {
|
||||
pp.WriteHelp(os.Stdout)
|
||||
os.Exit(0)
|
||||
}
|
||||
}
|
|
@ -1,133 +0,0 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"os"
|
||||
|
||||
"go.wit.com/lib/protobuf/forgepb"
|
||||
"go.wit.com/log"
|
||||
)
|
||||
|
||||
// sent via ldflags
|
||||
var VERSION string
|
||||
|
||||
func main() {
|
||||
f := forgepb.Init()
|
||||
|
||||
if argv.List {
|
||||
f.ConfigPrintTable()
|
||||
loop := f.Config.SortByGoPath() // get the list of forge configs
|
||||
for loop.Scan() {
|
||||
r := loop.Next()
|
||||
log.Info("repo:", r.GoPath)
|
||||
}
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
// try to delete, then save config and exit
|
||||
if argv.Delete {
|
||||
if f.Config.DeleteByGoPath(argv.GoPath) {
|
||||
log.Info("deleted", argv.GoPath, "did not exist. did nothing")
|
||||
os.Exit(0)
|
||||
}
|
||||
log.Info("deleted", argv.GoPath, "ok")
|
||||
f.ConfigSave()
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
// try to update, then save config and exit
|
||||
if argv.Update {
|
||||
/*
|
||||
if f.UpdateGoPath(argv.Name, argv.GoPath) {
|
||||
// save updated config file
|
||||
repos.ConfigSave()
|
||||
}
|
||||
*/
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
// try to add, then save config and exit
|
||||
if argv.Add {
|
||||
log.Info("going to add a new repo", argv.GoPath)
|
||||
new1 := forgepb.ForgeConfig{
|
||||
GoPath: argv.GoPath,
|
||||
Writable: argv.Writable,
|
||||
ReadOnly: argv.ReadOnly,
|
||||
Private: argv.Private,
|
||||
Directory: argv.Directory,
|
||||
Favorite: argv.Favorite,
|
||||
Interesting: argv.Interesting,
|
||||
}
|
||||
|
||||
if f.Config.Append(&new1) {
|
||||
log.Info("added", new1.GoPath, "ok")
|
||||
} else {
|
||||
log.Info("added", new1.GoPath, "failed")
|
||||
os.Exit(-1)
|
||||
}
|
||||
f.ConfigSave()
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
// testMemoryCorruption(f)
|
||||
f.ConfigSave()
|
||||
}
|
||||
|
||||
/*
|
||||
// this fucks shit up
|
||||
func testMemoryCorruption(all *forgepb.Repos) *forgepb.Repos {
|
||||
new1 := new(forgepb.Repo)
|
||||
new1.Name = "bash1"
|
||||
new1.Version = "5.2.21"
|
||||
if all.Append(new1) {
|
||||
log.Info("added", new1.Name, "ok")
|
||||
} else {
|
||||
log.Info("added", new1.Name, "failed")
|
||||
}
|
||||
|
||||
new1 = new(forgepb.Repo)
|
||||
new1.Name = "zookeeper1"
|
||||
new1.Debname = "zookeeper-go"
|
||||
if all.Append(new1) {
|
||||
log.Info("added", new1.Name, "ok")
|
||||
} else {
|
||||
log.Info("added", new1.Name, "failed")
|
||||
}
|
||||
|
||||
new1 = new(forgepb.Repo)
|
||||
new1.Name = "wit-package"
|
||||
new1.Private = true
|
||||
if all.Append(new1) {
|
||||
log.Info("added", new1.Name, "ok")
|
||||
} else {
|
||||
log.Info("added", new1.Name, "failed")
|
||||
}
|
||||
|
||||
new1 = new(forgepb.Repo)
|
||||
new1.Name = "networkQuality"
|
||||
new1.Debname = "networkquality"
|
||||
new1.Readonly = true
|
||||
if all.Append(new1) {
|
||||
log.Info("added", new1.Name, "ok")
|
||||
} else {
|
||||
log.Info("added", new1.Name, "failed")
|
||||
}
|
||||
|
||||
new2 := new(forgepb.Repo)
|
||||
new2.Name = "go-clone"
|
||||
new2.Version = "0.6.8" // good version of the macos
|
||||
if all.Append(new2) {
|
||||
log.Info("added", new2.Name, "ok")
|
||||
} else {
|
||||
log.Info("added", new2.Name, "failed")
|
||||
}
|
||||
|
||||
if all.Append(new2) {
|
||||
log.Info("added", new2.Name, "ok (this is bad)")
|
||||
} else {
|
||||
log.Info("added", new2.Name, "failed (but ok)")
|
||||
}
|
||||
|
||||
fmt.Println("packages are:", len(all.Repos))
|
||||
return all
|
||||
}
|
||||
*/
|
Loading…
Reference in New Issue