Skip to content

Commit 4e094e7

Browse files
committed
Initial commands
1 parent a71b159 commit 4e094e7

15 files changed

+1026
-0
lines changed

.gitignore

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Binaries for programs and plugins
2+
*.exe
3+
*.dll
4+
*.so
5+
*.dylib
6+
7+
# Test binary, build with `go test -c`
8+
*.test
9+
10+
# Output of the go coverage tool, specifically when used with LiteIDE
11+
*.out
12+
13+
# Project-local glide cache, RE: https://github.com/Masterminds/glide/issues/736
14+
.glide/
15+
16+
.virtualgo
17+
18+
/vendor/

Gopkg.lock

+45
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Gopkg.toml

+106
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
2+
## Gopkg.toml example (these lines may be deleted)
3+
4+
## "metadata" defines metadata about the project that could be used by other independent
5+
## systems. The metadata defined here will be ignored by dep.
6+
# [metadata]
7+
# key1 = "value that convey data to other systems"
8+
# system1-data = "value that is used by a system"
9+
# system2-data = "value that is used by another system"
10+
11+
## "required" lists a set of packages (not projects) that must be included in
12+
## Gopkg.lock. This list is merged with the set of packages imported by the current
13+
## project. Use it when your project needs a package it doesn't explicitly import -
14+
## including "main" packages.
15+
# required = ["github.com/user/thing/cmd/thing"]
16+
17+
## "ignored" lists a set of packages (not projects) that are ignored when
18+
## dep statically analyzes source code. Ignored packages can be in this project,
19+
## or in a dependency.
20+
# ignored = ["github.com/user/project/badpkg"]
21+
22+
## Constraints are rules for how directly imported projects
23+
## may be incorporated into the depgraph. They are respected by
24+
## dep whether coming from the Gopkg.toml of the current project or a dependency.
25+
# [[constraint]]
26+
## Required: the root import path of the project being constrained.
27+
# name = "github.com/user/project"
28+
#
29+
## Recommended: the version constraint to enforce for the project.
30+
## Only one of "branch", "version" or "revision" can be specified.
31+
# version = "1.0.0"
32+
# branch = "master"
33+
# revision = "abc123"
34+
#
35+
## Optional: an alternate location (URL or import path) for the project's source.
36+
# source = "https://github.com/myfork/package.git"
37+
#
38+
## "metadata" defines metadata about the dependency or override that could be used
39+
## by other independent systems. The metadata defined here will be ignored by dep.
40+
# [metadata]
41+
# key1 = "value that convey data to other systems"
42+
# system1-data = "value that is used by a system"
43+
# system2-data = "value that is used by another system"
44+
45+
## Overrides have the same structure as [[constraint]], but supersede all
46+
## [[constraint]] declarations from all projects. Only [[override]] from
47+
## the current project's are applied.
48+
##
49+
## Overrides are a sledgehammer. Use them only as a last resort.
50+
# [[override]]
51+
## Required: the root import path of the project being constrained.
52+
# name = "github.com/user/project"
53+
#
54+
## Optional: specifying a version constraint override will cause all other
55+
## constraints on this project to be ignored; only the overridden constraint
56+
## need be satisfied.
57+
## Again, only one of "branch", "version" or "revision" can be specified.
58+
# version = "1.0.0"
59+
# branch = "master"
60+
# revision = "abc123"
61+
#
62+
## Optional: specifying an alternate source location as an override will
63+
## enforce that the alternate location is used for that project, regardless of
64+
## what source location any dependent projects specify.
65+
# source = "https://github.com/myfork/package.git"
66+
67+
# required = [
68+
# 'github.com/golang/dep/cmd/dep',
69+
# 'github.com/golang/mock/gomock',
70+
# 'github.com/golang/mock/mockgen',
71+
# ]
72+
#
73+
#
74+
# [metadata]
75+
# # install_required = true
76+
# install = [
77+
# 'github.com/golang/dep/cmd/dep',
78+
# 'github.com/golang/mock/...',
79+
# ]
80+
81+
required = [
82+
'github.com/jteeuwen/go-bindata/go-bindata'
83+
]
84+
85+
[metadata]
86+
install_required = true
87+
88+
[[constraint]]
89+
branch = "master"
90+
name = "github.com/golang/dep"
91+
92+
[[constraint]]
93+
branch = "master"
94+
name = "github.com/BurntSushi/toml"
95+
96+
[[constraint]]
97+
branch = "master"
98+
name = "github.com/inconshreveable/mousetrap"
99+
100+
[[constraint]]
101+
version = "^0.8.0"
102+
name = "github.com/pkg/errors"
103+
104+
[[constraint]]
105+
branch = "master"
106+
name = "github.com/spf13/cobra"

Makefile

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
2+
GO_FILES = $(shell find . -name "*.go" | grep -v "^./vendor/" |grep -v "_test.go$$" | xargs)
3+
4+
BINDATA = cmd/bindata.go
5+
6+
install: $(GO_FILES) $(BINDATA)
7+
go install
8+
9+
bindata: $(BINDATA)
10+
$(BINDATA): data/*
11+
go-bindata -o cmd/bindata.go -pkg cmd data/*

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# virtualgo
2+
A virtualenv like solution to the go package isolation problem

cmd/activate.go

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
// Copyright © 2017 Jelte Fennema <[email protected]>
2+
//
3+
4+
package cmd
5+
6+
import (
7+
"github.com/pkg/errors"
8+
"github.com/spf13/cobra"
9+
)
10+
11+
// activateCmd represents the activate command
12+
var activateCmd = &cobra.Command{
13+
Use: "activate [environmentName]",
14+
Short: "Activate a specific virtualgo environment",
15+
Long: `
16+
The most simple way to use it is to activate an environment named after the
17+
current directory, by just calling:
18+
19+
vg activate
20+
21+
If you want to activate a specific environment you can specify it as an
22+
optional argument like this:
23+
24+
vg activate my-personal-env
25+
`,
26+
RunE: func(cmd *cobra.Command, args []string) error {
27+
return errors.New("You haven't eval-ed `vg eval` yet.")
28+
},
29+
}
30+
31+
func init() {
32+
RootCmd.AddCommand(activateCmd)
33+
34+
// Here you will define your flags and configuration settings.
35+
36+
// Cobra supports Persistent Flags which will work for this command
37+
// and all subcommands, e.g.:
38+
// activateCmd.PersistentFlags().String("foo", "", "A help for foo")
39+
40+
// Cobra supports local flags which will only run when this command
41+
// is called directly, e.g.:
42+
// activateCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
43+
}

0 commit comments

Comments
 (0)