Skip to content

Commit

Permalink
initia commit with setup files
Browse files Browse the repository at this point in the history
  • Loading branch information
qmuntal committed Nov 6, 2018
1 parent b2281e6 commit c8558e9
Show file tree
Hide file tree
Showing 6 changed files with 97 additions and 0 deletions.
21 changes: 21 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@


language: go
go_import_path: github.com/qmuntal/gopc

go:
- 1.10.x
- 1.11.x

env:
- GO111MODULE=on

notifications:
- email: false

before_script:
- make setup

script:
- go test ./... -coverprofile=coverage.out -race -timeout=5s
- $GOPATH/bin/goveralls -coverprofile=coverage.out -service=travis-ci
43 changes: 43 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
.PHONY: setup
setup: ## Install all the build and lint dependencies
go get -u github.com/mattn/goveralls
go get -u golang.org/x/tools/cmd/cover
go get -t -v ./...

.PHONY: setup-dev
setup-dev: setup ## Install all the build, lint and dev dependencies
go install github.com/golang/mock/mockgen

.PHONY: verify
verify: ## Verify module
go mod tidy
go mod verify

.PHONY: gen
gen: ## RUn go generate in all the directories
go generate ./...

.PHONY: test
test: ## Run all the tests
go test ./... -timeout=5s

.PHONY: cover
cover: ## Run all the tests with race detection and opens the coverage report
go test ./... -coverprofile=coverage.out -race -timeout=5s
go tool cover -html=coverage.out

.PHONY: ci
ci: ## Run all the tests and code checks
verify
lint
test

.PHONY: build
build: ## Build a version
go build -v ./...

.PHONY: clean
clean: ## Remove temporary files
go clean

.DEFAULT_GOAL := build
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module github.com/qmuntal/gopc
Empty file added go.sum
Empty file.
10 changes: 10 additions & 0 deletions gopc/relationship.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package gopc

// Relationship defines an OPC Package Relationship Object.
type Relationship struct {
}

// NewRelationship creates a new relationship.
func NewRelationship() *Relationship {
return new(Relationship)
}
22 changes: 22 additions & 0 deletions gopc/relationship_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package gopc

import (
"reflect"
"testing"
)

func TestNewRelationship(t *testing.T) {
tests := []struct {
name string
want *Relationship
}{
{"new", new(Relationship)},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := NewRelationship(); !reflect.DeepEqual(got, tt.want) {
t.Errorf("NewRelationship() = %v, want %v", got, tt.want)
}
})
}
}

0 comments on commit c8558e9

Please sign in to comment.