Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge in changes from @asnowfix fork #17

Merged
merged 132 commits into from
Dec 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
132 commits
Select commit Hold shift + click to select a range
656b1e4
Added ova import
mzollneritsch-nc Oct 2, 2017
f73cdf2
Added SetHostOnlyAdapter function to machine
mzollneritsch-nc Oct 2, 2017
75a5e4b
Fixed sethostonlyadapter bug.
mzollneritsch-nc Oct 2, 2017
8da4fd4
Removed unnecessarily added function
mzollneritsch-nc Oct 2, 2017
5cecf1c
Added disconnect serialport method
mzollneritsch-nc Oct 2, 2017
3479551
Added better windows virtualbox detection.
mzollneritsch-nc Oct 3, 2017
ee0d1ca
Added hostonlyfix for windows
mzollneritsch-nc Oct 3, 2017
e441b70
Windows name fix
mzollneritsch-nc Oct 3, 2017
7f49ad4
Add base support to set & get guest properties from the host
Apr 20, 2018
c2b3093
Base Makefile with Go linter
Apr 20, 2018
0b4f549
Add base support to set & get guest properties from the host
Apr 20, 2018
c2d6901
Initialize dependencies
asnowfix Apr 20, 2018
befb0fa
Fix missing string space-trim
asnowfix Apr 20, 2018
6ce72d8
Generate a test Vagrant-based VirtualBox VM
asnowfix Apr 20, 2018
2ed7943
Add post-test instructions
asnowfix Apr 20, 2018
6106a63
Merge
Apr 20, 2018
5a78eb4
Validate on Windows
Apr 20, 2018
c373fd5
Get value out of multiline output
Apr 21, 2018
7fe6f34
Add support for DeleteGuestProperty
Apr 21, 2018
ecc81b9
Fix go style warning in guestprop.go
Apr 21, 2018
42e4f91
Merge pull request #1 from asnowfix/guest-properties
asnowfix Apr 21, 2018
434c562
Ignore GoLang vendor/ libraries
Apr 23, 2018
18b2135
Make VBoxManage mock-able
Apr 22, 2018
4b19fa6
Try gomock, but the genrated code does not support multiple returned …
Apr 23, 2018
32714a2
Working gomock tests
Apr 23, 2018
ff50742
Merge pull request #2 from asnowfix/add-gomock
asnowfix Apr 23, 2018
bb305ae
Prepare for VBoxManage global mock
Apr 23, 2018
f71c597
Add test data
Apr 23, 2018
65e1c67
Update dependencies
asnowfix Apr 23, 2018
d40539b
Working mocked machine_test.go
asnowfix Apr 24, 2018
de5bf08
Clean machine_test.go
asnowfix Apr 24, 2018
94d107a
Working list hostonlynet
asnowfix Apr 24, 2018
f5f0b84
Working mocked list natnets
asnowfix Apr 24, 2018
57edaba
Merge pull request #3 from asnowfix/total-gomock
asnowfix Apr 24, 2018
102ed31
Use mocked tests by default
Apr 24, 2018
79a4855
Setup CircleCI w/ default configuration for GoLang
Apr 24, 2018
d46af99
Add CircleCI status badge
Apr 24, 2018
44a627c
Make sure dependencies are installed
Apr 24, 2018
4f1853d
Trying to fix build break
Apr 24, 2018
6d2aed8
get dep tool
Apr 24, 2018
2ea5afc
Get Go dep tool from the proper location
Apr 24, 2018
f226aff
Add mock to list DHCP servers
Apr 24, 2018
3002d59
Merge pull request #4 from asnowfix/circle-ci
asnowfix Apr 24, 2018
2237176
adding clone machine function
jdavidthomson Apr 24, 2018
01a1945
variable was wrong - baseImageName
jdavidthomson Apr 24, 2018
3260aca
Start TravisCI
asnowfix Apr 25, 2018
7cbd2a6
Add TravisCI badge
asnowfix Apr 25, 2018
c834a82
Merge pull request #6 from asnowfix/travis-ci
asnowfix Apr 25, 2018
8c61c77
Fix godoc warnings.
asnowfix Apr 25, 2018
4897f48
Document command to re-generate mocks
Apr 25, 2018
da9accd
Merge pull request #7 from asnowfix/fix-godoc-warnings
asnowfix Apr 25, 2018
5e3f7e9
Add badges to test them
Apr 26, 2018
58a0f35
Merge pull request #8 from asnowfix/badges
asnowfix Apr 26, 2018
5026ada
Block-wait on guestproperty change
Apr 26, 2018
0081112
Merge pull request #5 from jdavidthomson/master
asnowfix Apr 26, 2018
ffcd919
Ignore GoDoc
Apr 27, 2018
395f749
GoDoc typo
Apr 27, 2018
20bf2ce
First crack at channels to wait for guest properties (DOES NOT WORK)
Apr 27, 2018
1906dcc
WaitGuestProperties works w/ real VM
Apr 28, 2018
c15af06
Add WaitGroup before returning
Apr 29, 2018
70cc36e
Refactor WaitGuestProperties API
Apr 29, 2018
5dde238
Add godoc for WaitGetProperties
Apr 29, 2018
3eea453
Implement TestWaitGuestProperty() with mocked VM
Apr 29, 2018
c250c80
Make stricter the guestproperty change consumption rate to ease testa…
Apr 29, 2018
35a1507
Merge pull request #9 from asnowfix/wait-guestproperty
asnowfix Apr 29, 2018
dc1daae
Make command execution generic (DOES NOT WORK)
May 5, 2018
004cdb5
Abstract VBoxManage from Command
asnowfix May 5, 2018
bb59ca1
Re-org variables
asnowfix May 5, 2018
b8ffec4
Fix GoLang warning of contributed method Clone()
asnowfix May 5, 2018
7eae958
New command: Control()
asnowfix May 5, 2018
ccfe1e5
Add ability to build & test in Vagrant VM
asnowfix May 8, 2018
2a343ba
Add sudo support via setOpts() using visitor's pattern
asnowfix May 8, 2018
a38d22d
Fix mock generation command
asnowfix May 8, 2018
7373a34
Add gofoc instructions
asnowfix May 8, 2018
d4516b0
Automate TestWaitGuestProperty() with real VM
asnowfix May 8, 2018
429a6a2
TestWaitGuestProperties() with real VM
asnowfix May 8, 2018
51f1832
GoDoc usage improvement
asnowfix May 8, 2018
ac8f03e
Working visitor pattern to set sudo() option
asnowfix May 10, 2018
17dd70c
Detection host/guest (impl is **really** crappy...)
asnowfix May 10, 2018
e17e1bd
Add CAVEATS: there is so much to do in this code to make it attractiv…
asnowfix May 10, 2018
b44ab4d
Move debug logger in dedicated function
asnowfix May 11, 2018
bafa40c
Cleanup logs
asnowfix May 11, 2018
5391fb0
Delete unused file
asnowfix May 11, 2018
e8aea2c
Fix test on a system w/o VBox installed
asnowfix May 11, 2018
46173e2
Update Verbose value at each call to Debug() to avoid startup effects
asnowfix May 11, 2018
1f50bbb
guestprop get now matches multiline outputs (such as VBoxControl ones)
asnowfix May 11, 2018
8116acd
Replace init() by Manage() accessor
asnowfix May 11, 2018
fac289f
Better GoDoc to include Guest Properties
asnowfix May 11, 2018
7b95ec3
Merge pull request #10 from asnowfix/in-guest-vboxcontrol
asnowfix May 11, 2018
2be1045
Change WaitGuestProperties() signature to match real-life usage
asnowfix May 19, 2018
31f6623
Clean-up tester Log()
asnowfix May 19, 2018
cb931ff
Add host-side daemon waiting for properties changes
asnowfix May 19, 2018
e436cca
Add manual to use vboxhostd
asnowfix May 19, 2018
aacf871
Fix Linux guest
asnowfix May 20, 2018
683906c
Implement open on Windows too
asnowfix May 20, 2018
06f9a5a
Merge pull request #11 from asnowfix/add-host-cmd
asnowfix May 20, 2018
137b4e8
Merge remote-tracking branch 'origin/master' into makefile-helper
asnowfix May 20, 2018
fbcabbf
Enable "make linit" with gometalinter
asnowfix May 20, 2018
9394118
Fix gometalinter issues
asnowfix May 20, 2018
5b08431
Assume sub-process startup being not a security issue
asnowfix May 20, 2018
0781b45
Check that opened items are URL's
asnowfix May 20, 2018
07d72c7
Document Make targets
asnowfix May 20, 2018
f0079d1
Remove duplicated code
asnowfix May 20, 2018
0d17810
Check errors
asnowfix May 20, 2018
b92df9d
Configure gometalinter
asnowfix May 20, 2018
d0141a2
Flag command-line start as not a security issue
asnowfix May 20, 2018
7274cdf
Fix TravisCI build always use `make` when Makefile exists
asnowfix May 20, 2018
6480517
Break-down CircleCI build
asnowfix May 20, 2018
a612cec
Exit using timeout if one WaitGuestPRoperties() fails
asnowfix May 21, 2018
e35ae9a
Use return instead of channel boiler-plate
asnowfix May 21, 2018
6a57706
Add `\n` to fmt.Printf()
asnowfix May 21, 2018
d1ec98e
Fix Makefile on Windows
May 21, 2018
8e3eaa9
vbhosts/open now works on Windows
May 22, 2018
bc373b9
Add new target to build binaries for every packages (incl. on Windows)
May 23, 2018
e3af603
Fail if GOROOT/GOPATH are not defined
May 22, 2018
d21f04f
Blacklist Ubuntu's Virtualbox kernel modules
May 22, 2018
4417468
Fix ownership of GO folder structure in Vagrant
May 22, 2018
d2b04b0
Fix `make` when running in Vagrant on Windows
May 22, 2018
2cf5526
Document Makefile sections purpose
May 22, 2018
c1d94d9
GOROOT is nopt required, having `go` in PATH is
May 22, 2018
3131ad4
Merge pull request #14 from asnowfix/add-host-cmd
asnowfix May 23, 2018
6a3501c
Merge branch 'master' into makefile-helper
May 23, 2018
37d1231
Merge pull request #15 from asnowfix/makefile-helper
asnowfix May 23, 2018
19505d3
Git-ignore vboxhostd
Aug 28, 2018
27efe5f
gas is renamed gosec
Aug 30, 2018
923920f
gas => gosec (2nd, in metalinter)
Sep 7, 2018
84ae0c0
Merge commit '923920f55e3cc88f6876d2d06e9abd3b7ac93393' into merge-in…
ringods Nov 30, 2019
b266592
Adding Go 1.13.4 to the build setup
ringods Nov 30, 2019
44041a6
Fixes for Go 1.13 specific testing changes.
ringods Nov 30, 2019
56936de
Fixes a lint issue about an exported function requiring documentation.
ringods Nov 30, 2019
8a740c9
Attempt to activate a matrix build of this project via Github Actions.
ringods Nov 30, 2019
8bbcdfe
Remove CircleCI and TravisCI configurations.
ringods Nov 30, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Continuous Integration
on: [push]
jobs:
build:
name: Build
runs-on: ${{ matrix.os }}
strategy:
matrix:
go: ["1.12", "1.13"]
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- name: Set up Go 1.13
uses: actions/setup-go@v1
with:
go-version: ${{ matrix.go }}
id: go

- name: Check out code into the Go module directory
uses: actions/checkout@v1

- name: Get dependencies
run: |
go get -v -t -d ./...

- name: Build
run: go build -v .

- name: Run Unit Tests
run: go test -v .
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
coverage.txt
/.vagrant
/vendor
/godoc*
/vbhostd*
60 changes: 60 additions & 0 deletions .gometalinter.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{
"Enable": [
"deadcode",
"errcheck",
"gosec",
"goconst",
"gofmt",
"golint",
"gotype",
"gotypex",
"ineffassign",
"interfacer",
"maligned",
"megacheck",
"misspell",
"nakedret",
"safesql",
"structcheck",
"test",
"testify",
"unconvert",
"unparam",
"varcheck",
"vet",
"vetshadow"
],
"List": [
["deadcode", "github.com/tsenart/deadcode"],
["dupl", "github.com/mibk/dupl"],
["errcheck", "github.com/kisielk/errcheck"],
["gosec", "github.com/securego/gosec"],
["goconst", "github.com/jgautheron/goconst/cmd/goconst"],
["gocyclo", "github.com/alecthomas/gocyclo"],
["gofmt"],
["goimports", "golang.org/x/tools/cmd/goimports"],
["golint", "github.com/golang/lint/golint"],
["gosimple", "honnef.co/go/tools/cmd/gosimple"],
["gotype", "golang.org/x/tools/cmd/gotype"],
["gotypex", "golang.org/x/tools/cmd/gotype"],
["ineffassign", "github.com/gordonklaus/ineffassign"],
["interfacer", "mvdan.cc/interfacer"],
["lll", "github.com/walle/lll/cmd/lll"],
["maligned", "github.com/mdempsky/maligned"],
["megacheck", "honnef.co/go/tools/cmd/megacheck"],
["misspell", "github.com/client9/misspell/cmd/misspell"],
["nakedret", "github.com/alexkohler/nakedret"],
["safesql", "github.com/stripe/safesql"],
["staticcheck", "honnef.co/go/tools/cmd/staticcheck"],
["structcheck", "github.com/opennota/check/cmd/structcheck"],
["test"],
["testify"],
["unconvert", "github.com/mdempsky/unconvert"],
["unparam", "mvdan.cc/unparam"],
["unused", "honnef.co/go/tools/cmd/unused"],
["varcheck", "github.com/opennota/check/cmd/varcheck"],
["vet"],
["vetshadow"]
]
}

19 changes: 0 additions & 19 deletions .travis.yml

This file was deleted.

21 changes: 21 additions & 0 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 30 additions & 0 deletions Gopkg.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Gopkg.toml example
#
# Refer to https://golang.github.io/dep/docs/Gopkg.toml.html
# for detailed Gopkg.toml documentation.
#
# required = ["github.com/user/thing/cmd/thing"]
# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"]
#
# [[constraint]]
# name = "github.com/user/project"
# version = "1.0.0"
#
# [[constraint]]
# name = "github.com/user/project2"
# branch = "dev"
# source = "github.com/myfork/project2"
#
# [[override]]
# name = "github.com/x/y"
# version = "2.4.0"
#
# [prune]
# non-go = false
# go-tests = true
# unused-packages = true


[prune]
go-tests = true
unused-packages = true
110 changes: 110 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
## Setup -- cross-OS

ME := $(shell id -un)
$(info ME=$(ME))
INTERACTIVE:=$(shell [ -t 0 ] && echo 1)
$(info INTERACTIVE=$(INTERACTIVE))
ifdef INTERACTIVE
# is a terminal
else
# cron job / other
endif

ifeq ($(OS),Windows_NT)
EXE := .exe
endif

ifeq ($(GOPATH),)
$(error GOPATH undefined)
endif

## Package --

ifeq ($(ME),vagrant)
# FIXME: any better way?
ROOTPKG := github.com/terra-farm/go-virtualbox
PKGS := $(filter-out /vendor%,$(shell cd $(GOPATH)/src/$(ROOTPKG) && go list ./...))
else
ROOTPKG := $(shell go list .)
PKGS := $(filter-out /vendor%,$(shell go list ./...))
endif
$(info PKGS=$(PKGS))

default: deps test lint build-pkgs

## Dependencies --

DEP_NAME := dep
DEP := $(GOPATH)/bin/$(DEP_NAME)$(EXE)

.PHONY: deps
deps: $(DEP)
go get -t -d -v ./...
ifeq ($(ME),vagrant)
cd $(GOPATH)/src/$(ROOTPKG) && $(DEP) ensure -v
else
$(DEP) ensure -v
endif

$(DEP):
go get -v github.com/golang/dep/cmd/dep

## Build, build tests & run them --

.PHONY: build test
build test:
go $(@) -v ./...

## build-pkgs -- generate binaries

.PHONY: build-pkgs
build-pkgs: $(foreach pkg,$(PKGS),build-pkg-$(basename $(pkg)))

define build-pkg
build-pkg-$(basename $(1)):
go build -v $(1)
endef

$(foreach pkg,$(PKGS),$(eval $(call build-pkg,$(pkg))))

# `go get` asks for credentials when needed
ifdef INTERACTIVE
GIT_TERMINAL_PROMPT := 1
export GIT_TERMINAL_PROMPT
endif

## Linting & scanning --

#GOMETALINTER_NAME := gometalinter.v2
GOMETALINTER_NAME := gometalinter
GOMETALINTER := $(GOPATH)/bin/$(GOMETALINTER_NAME)$(EXE)

$(GOMETALINTER):
# @echo PATH=$(PATH)
ifeq ($(GOMETALINTER_NAME),gometalinter)
go get -u github.com/alecthomas/$(GOMETALINTER_NAME)
else
go get -u gopkg.in/alecthomas/$(GOMETALINTER_NAME)
endif
$(@) --install

.PHONY: lint
lint: $(GOMETALINTER)
$(GOMETALINTER) ./... --vendor

## Release -- FIXME not yet ready

BINARY := mytool

VERSION ?= $(shell git describe --tags)

PLATFORMS := windows linux darwin

os = $(word 1, $@)

.PHONY: $(PLATFORMS)
$(PLATFORMS):
GOOS=$(os) GOARCH=amd64 go build -o release/$(BINARY)-$(VERSION)-$(os)-amd64

.PHONY: release
release: $(PLATFORMS)
Loading