Skip to content

Commit

Permalink
Merge pull request #9 from boschrexroth/feature/ver21
Browse files Browse the repository at this point in the history
Feature/ver21
  • Loading branch information
Johannes Albrecht committed Feb 6, 2024
2 parents f675bd2 + d245127 commit e96a4de
Show file tree
Hide file tree
Showing 394 changed files with 16,074 additions and 10,036 deletions.
33 changes: 33 additions & 0 deletions .editorconfig
@@ -0,0 +1,33 @@
# EditorConfig is awesome: https://EditorConfig.org

# top-most EditorConfig file
root = true

[*]
indent_style = space
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = false
insert_final_newline = false

[*]
insert_final_newline = true
charset = utf-8
trim_trailing_whitespace = true
indent_style = space
indent_size = 2

[{go.mod,go.sum,*.go,.gitmodules}]
indent_style = tab
indent_size = 4

[*.md]
indent_size = 4
trim_trailing_whitespace = false
eclint_indent_style = unset

[{Makefile,**.mk}]
# Use tabs for indentation (Makefiles require tabs)
indent_style = tab

8 changes: 4 additions & 4 deletions .github/workflows/main.yml
Expand Up @@ -24,13 +24,13 @@ jobs:
sudo apt-get update
sudo apt-get install -y libsystemd-dev libzmq3-dev
sudo apt install pkg-config
wget https://github.com/boschrexroth/ctrlx-automation-sdk/releases/download/2.2.0/ctrlx-datalayer-2.2.7.deb
sudo apt-get install -y -f ./ctrlx-datalayer-2.2.7.deb
wget https://github.com/boschrexroth/ctrlx-automation-sdk/releases/download/2.4.0/ctrlx-datalayer-2.4.5.deb
sudo apt-get install -y -f ./ctrlx-datalayer-2.4.5.deb
- name: Go
uses: actions/setup-go@v3
with:
go-version: 1.19
go-version: 1.21

- name: Test
run: |
Expand All @@ -42,7 +42,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.19
go-version: 1.21
- name: Run go test
run: |
ls -lah
Expand Down
117 changes: 60 additions & 57 deletions Makefile
@@ -1,57 +1,60 @@
PROJECT_NAME := "ctrlx-datalayer-golang"
PKG := "github.com/boschrexroth/$(PROJECT_NAME)"
PKG_LIST := ./pkg/datalayer ./pkg/sseclient ./pkg/token
COV_PKG_LIST := ./pkg/datalayer,./pkg/sseclient,./pkg/token
TST_LIST := ./test/datalayer ./test/sseclient ./test/token
GO_FILES := $(shell find . -name '*.go' | grep -v /vendor/ | grep -v _test.go)
GOOS := $(shell go env GOOS)
GOARCH := $(shell go env GOARCH)
BUILD := build/public/$(GOOS)_$(GOARCH)

DATALAYER_DEB_VERSION := 2.2.0
DATALAYER_DEB_FILE_VERSION := 2.2.7

.PHONY: all go-dep apt-dep lint vet test test-coverage build clean

all: build

go-dep: ## Get go dependencies
@go mod download
@go mod vendor

apt-dep: ## Get native dependencies
@sudo apt-get update
@sudo apt-get install -y libsystemd-dev libzmq3-dev
@wget --quiet https://github.com/boschrexroth/ctrlx-automation-sdk/releases/download/$(DATALAYER_DEB_VERSION)/ctrlx-datalayer-${DATALAYER_DEB_FILE_VERSION}.deb
@sudo apt-get install -y -f ./ctrlx-datalayer-${DATALAYER_DEB_FILE_VERSION}.deb
@rm ctrlx-datalayer-${DATALAYER_DEB_FILE_VERSION}.deb

lint: ## Lint Golang files
@golangci-lint run

vet: ## Run go vet
@go vet $(PKG_LIST)

test: ## Run unittests
@go test -race -short -count=1 -mod=vendor $(TST_LIST)

memprofile: ## Run memory profiler
@go test -race -short -count=1 -mod=vendor $(TST_LIST) -memprofile mem.pprof -memprofilerate 1
@go tool pprof -http=:8080 mem.pprof

cpuprofile: ## Run cpu profiler
@go test -race -short -count=1 -mod=vendor $(TST_LIST) -cpuprofile cpu.pprof
@go tool pprof -http=:8080 cpu.pprof

testcover: ## Run unittests with coverage 'go tool cover -html=coverage.out -o coverage.html'
@go test -race -short -count=1 -mod=vendor -coverpkg=$(COV_PKG_LIST) -coverprofile=coverage.out -covermode=atomic $(TST_LIST)

build: go-dep ## Build the samples
@CGO_ENABLED=1 go build -mod=vendor -o $(BUILD)/datalayer ./cmd/datalayer
@CGO_ENABLED=1 go build -mod=vendor -o $(BUILD)/benchmark ./cmd/benchmark

clean: ## Remove previously build samples
@rm -rf $(BUILD)/*

help: ## Display this help screen
@grep -h -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
PROJECT_NAME := "ctrlx-datalayer-golang"
PKG := "github.com/boschrexroth/$(PROJECT_NAME)"
PKG_LIST := ./pkg/datalayer ./pkg/sseclient ./pkg/token
COV_PKG_LIST := ./pkg/datalayer,./pkg/sseclient,./pkg/token
TST_LIST := ./test/datalayer ./test/sseclient ./test/token
GO_FILES := $(shell find . -name '*.go' | grep -v /vendor/ | grep -v _test.go)
GOOS := $(shell go env GOOS)
GOARCH := $(shell go env GOARCH)
BUILD := build/public/$(GOOS)_$(GOARCH)

DATALAYER_DEB_VERSION := 2.4.0
DATALAYER_DEB_FILE_VERSION := 2.4.5

.PHONY: all go-dep apt-dep lint vet test test-coverage build clean

all: build

go-dep: ## Get go dependencies
@go mod download
@go mod vendor

apt-dep: ## Get native dependencies
@sudo apt-get update
@sudo apt-get install -y libsystemd-dev libzmq3-dev
@wget --quiet https://github.com/boschrexroth/ctrlx-automation-sdk/releases/download/$(DATALAYER_DEB_VERSION)/ctrlx-datalayer-${DATALAYER_DEB_FILE_VERSION}.deb
@sudo apt-get install -y -f ./ctrlx-datalayer-${DATALAYER_DEB_FILE_VERSION}.deb
@rm ctrlx-datalayer-${DATALAYER_DEB_FILE_VERSION}.deb

lint: ## Lint Golang files
@golangci-lint run

vet: ## Run go vet
@go vet $(PKG_LIST)

test: ## Run unittests
@go test -race -short -count=1 -mod=vendor $(TST_LIST)

memprofile: ## Run memory profiler
@go test -race -short -count=1 -mod=vendor $(TST_LIST) -memprofile mem.pprof -memprofilerate 1
@go tool pprof -http=:8080 mem.pprof

cpuprofile: ## Run cpu profiler
@go test -race -short -count=1 -mod=vendor $(TST_LIST) -cpuprofile cpu.pprof
@go tool pprof -http=:8080 cpu.pprof

testcover: ## Run unittests with coverage 'go tool cover -html=coverage.out -o coverage.html'
@go test -race -short -count=1 -mod=vendor -coverpkg=$(COV_PKG_LIST) -coverprofile=coverage.out -covermode=atomic $(TST_LIST)

testreport: ## Run unittests with coverage 'go tool cover -html=coverage.out -o coverage.html' and junit report
@go test -v 2>&1 -race -short -count=1 -mod=vendor -coverpkg=$(COV_PKG_LIST) -coverprofile=coverage.out -covermode=atomic $(TST_LIST) | go-junit-report -set-exit-code > test-results.junit.xml

build: go-dep ## Build the samples
@CGO_ENABLED=1 go build -mod=vendor -o $(BUILD)/datalayer ./cmd/datalayer
@CGO_ENABLED=1 go build -mod=vendor -o $(BUILD)/benchmark ./cmd/benchmark

clean: ## Remove previously build samples
@rm -rf $(BUILD)/*

help: ## Display this help screen
@grep -h -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
6 changes: 3 additions & 3 deletions README.md
Expand Up @@ -44,15 +44,15 @@ sudo apt-get install libsystemd-dev libsystemd-dev:arm64 libzmq3-dev libzmq3-dev
Check the current [ctrlx Data Layer](https://github.com/boschrexroth/ctrlx-automation-sdk/releases) debian package, download and install this, see example.

```bash
wget https://github.com/boschrexroth/ctrlx-automation-sdk/releases/download/2.2.0/ctrlx-datalayer-2.2.7.deb
sudo dpkg -i ctrlx-datalayer-2.2.7.deb
wget https://github.com/boschrexroth/ctrlx-automation-sdk/releases/download/2.4.0/ctrlx-datalayer-2.4.5.deb
sudo dpkg -i ctrlx-datalayer-2.4.5.deb
```

### Integrate in you project

To integrate this library in your project, simply install it via:

`go get github.com/boschrexroth/ctrlx-datalayer-golang`
`go get github.com/boschrexroth/ctrlx-datalayer-golang/v2`

## About

Expand Down
2 changes: 1 addition & 1 deletion cmd/benchmark/benchmark.go
Expand Up @@ -33,7 +33,7 @@ import (
"testing"
"unsafe"

"github.com/boschrexroth/ctrlx-datalayer-golang/pkg/datalayer"
"github.com/boschrexroth/ctrlx-datalayer-golang/v2/pkg/datalayer"
"github.com/loov/hrtime/hrplot"
"github.com/loov/hrtime/hrtesting"
)
Expand Down
2 changes: 1 addition & 1 deletion cmd/benchmark/provider.go
Expand Up @@ -28,7 +28,7 @@ import (
"errors"
"time"

"github.com/boschrexroth/ctrlx-datalayer-golang/pkg/datalayer"
"github.com/boschrexroth/ctrlx-datalayer-golang/v2/pkg/datalayer"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion cmd/datalayer/main.go
Expand Up @@ -32,7 +32,7 @@ import (
"syscall"
"time"

"github.com/boschrexroth/ctrlx-datalayer-golang/pkg/datalayer"
"github.com/boschrexroth/ctrlx-datalayer-golang/v2/pkg/datalayer"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion cmd/datalayer/testNode.go
Expand Up @@ -27,7 +27,7 @@ package main
import (
"fmt"

"github.com/boschrexroth/ctrlx-datalayer-golang/pkg/datalayer"
"github.com/boschrexroth/ctrlx-datalayer-golang/v2/pkg/datalayer"
)

var goFloat float32 = 0.369
Expand Down
12 changes: 6 additions & 6 deletions go.mod
@@ -1,19 +1,19 @@
module github.com/boschrexroth/ctrlx-datalayer-golang
module github.com/boschrexroth/ctrlx-datalayer-golang/v2

go 1.19
go 1.21

require (
github.com/google/flatbuffers v23.5.26+incompatible
github.com/loov/hrtime v1.0.3
github.com/loov/hrtime/hrplot v1.0.2
github.com/oliveagle/jsonpath v0.0.0-20180606110733-2e52cf6e6852
github.com/stretchr/testify v1.7.0
github.com/stretchr/testify v1.8.4
gopkg.in/yaml.v2 v2.4.0
)

require (
github.com/davecgh/go-spew v1.1.0 // indirect
github.com/loov/plot v0.0.0-20200413101321-e09a6f01d2f5 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/loov/plot v0.0.0-20230104081220-6b3108899f6e // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
gopkg.in/yaml.v3 v3.0.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
17 changes: 8 additions & 9 deletions go.sum
@@ -1,25 +1,24 @@
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/google/flatbuffers v23.5.26+incompatible h1:M9dgRyhJemaM4Sw8+66GHBu8ioaQmyPLg1b8VwK5WJg=
github.com/google/flatbuffers v23.5.26+incompatible/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8=
github.com/loov/hrtime v1.0.1/go.mod h1:yDY3Pwv2izeY4sq7YcPX/dtLwzg5NU1AxWuWxKwd0p0=
github.com/loov/hrtime v1.0.3 h1:LiWKU3B9skJwRPUf0Urs9+0+OE3TxdMuiRPOTwR0gcU=
github.com/loov/hrtime v1.0.3/go.mod h1:yDY3Pwv2izeY4sq7YcPX/dtLwzg5NU1AxWuWxKwd0p0=
github.com/loov/hrtime/hrplot v1.0.2 h1:y9c7g1ao5AQOLzJxo4PLhAdFG0ehPIIy5eP6g9ymczc=
github.com/loov/hrtime/hrplot v1.0.2/go.mod h1:9t65xYn4d42ntjv40Wt5lbU72/VC5S0zGDgjC8kD5BU=
github.com/loov/plot v0.0.0-20200413101321-e09a6f01d2f5 h1:pzQgy0g937iWmXKKEM8uaDRL9oxB2+1hVAfV5hJ+yIA=
github.com/loov/plot v0.0.0-20200413101321-e09a6f01d2f5/go.mod h1:gSrhfSMoiPGG0CZ9E66kXjaHxFw0fzJhooyicOnz5z4=
github.com/loov/plot v0.0.0-20230104081220-6b3108899f6e h1:kJM0h0L+WIFj/jFnJ0EG/yZqen50QC1huXeFmIxPvFE=
github.com/loov/plot v0.0.0-20230104081220-6b3108899f6e/go.mod h1:y6pmRyrXJv2rEkDfcgqSuzLOOCT3voWvegA3G9H0dGI=
github.com/oliveagle/jsonpath v0.0.0-20180606110733-2e52cf6e6852 h1:Yl0tPBa8QPjGmesFh1D0rDy+q1Twx6FyU7VWHi8wZbI=
github.com/oliveagle/jsonpath v0.0.0-20180606110733-2e52cf6e6852/go.mod h1:eqOVx5Vwu4gd2mmMZvVZsgIqNSaW3xxRThUJ0k/TPk4=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.0 h1:hjy8E9ON/egN1tAYqKb61G10WtihqetD4sz2H+8nIeA=
gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
2 changes: 1 addition & 1 deletion pkg/datalayer/bulk_doc_test.go
@@ -1,7 +1,7 @@
package datalayer_test

import (
"github.com/boschrexroth/ctrlx-datalayer-golang/pkg/datalayer"
"github.com/boschrexroth/ctrlx-datalayer-golang/v2/pkg/datalayer"
)

func ExampleBulk_Browse() {
Expand Down
4 changes: 2 additions & 2 deletions pkg/datalayer/client.go
Expand Up @@ -38,8 +38,8 @@ import (
"unsafe"

// import of c-headers
_ "github.com/boschrexroth/ctrlx-datalayer-golang/pkg/datalayer/headers"
fbs "github.com/boschrexroth/ctrlx-datalayer-golang/pkg/fbs/comm/datalayer"
_ "github.com/boschrexroth/ctrlx-datalayer-golang/v2/pkg/datalayer/headers"
fbs "github.com/boschrexroth/ctrlx-datalayer-golang/v2/pkg/fbs/comm/datalayer"
)

// TimeoutSetting gets the settings of the different timeout values.
Expand Down
2 changes: 1 addition & 1 deletion pkg/datalayer/client_doc_test.go
@@ -1,7 +1,7 @@
package datalayer_test

import (
"github.com/boschrexroth/ctrlx-datalayer-golang/pkg/datalayer"
"github.com/boschrexroth/ctrlx-datalayer-golang/v2/pkg/datalayer"
)

func ExampleClient_Browse() {
Expand Down
2 changes: 1 addition & 1 deletion pkg/datalayer/converter_doc_test.go
Expand Up @@ -3,7 +3,7 @@ package datalayer_test
import (
"fmt"

"github.com/boschrexroth/ctrlx-datalayer-golang/pkg/datalayer"
"github.com/boschrexroth/ctrlx-datalayer-golang/v2/pkg/datalayer"
)

func ExampleConverter_GenerateJsonComplex() {
Expand Down
4 changes: 2 additions & 2 deletions pkg/datalayer/doc_test.go
Expand Up @@ -24,8 +24,8 @@
package datalayer_test

import (
"github.com/boschrexroth/ctrlx-datalayer-golang/pkg/datalayer"
fbs "github.com/boschrexroth/ctrlx-datalayer-golang/pkg/fbs/comm/datalayer"
"github.com/boschrexroth/ctrlx-datalayer-golang/v2/pkg/datalayer"
fbs "github.com/boschrexroth/ctrlx-datalayer-golang/v2/pkg/fbs/comm/datalayer"
)

func ExampleMetaDataBuilder() {
Expand Down
2 changes: 1 addition & 1 deletion pkg/datalayer/factory_doc_test.go
@@ -1,7 +1,7 @@
package datalayer_test

import (
"github.com/boschrexroth/ctrlx-datalayer-golang/pkg/datalayer"
"github.com/boschrexroth/ctrlx-datalayer-golang/v2/pkg/datalayer"
)

func ExampleFactory_CreateProvider() {
Expand Down

0 comments on commit e96a4de

Please sign in to comment.