From 00a8203d5e4d6fdd8854413a72585bb1d3d32762 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Malte=20M=C3=BCnch?= Date: Mon, 15 Apr 2024 20:22:50 +0200 Subject: [PATCH] Update folder structure (#40) * Refactored folder structure, updated go.mod * Update GitHub Actions for new folder structure Signed-off-by: Malte Muench --- .github/workflows/go.yml | 12 +++++++----- .github/workflows/release.yaml | 4 ++-- examples/c3re.csv => example.csv | 0 go.mod | 15 --------------- go.sum | 18 ------------------ can2mqtt/main.go => src/can2mqtt.go | 2 +- src/go.mod | 15 +++++++++++++++ src/go.sum | 13 +++++++++++++ .../internal/canbushandling.go | 2 +- .../internal/convertfunctions.go | 2 +- main.go => src/internal/main.go | 2 +- .../internal/mqtthandling.go | 2 +- .../internal/receivehandling.go | 2 +- 13 files changed, 43 insertions(+), 46 deletions(-) rename examples/c3re.csv => example.csv (100%) delete mode 100644 go.mod delete mode 100644 go.sum rename can2mqtt/main.go => src/can2mqtt.go (96%) create mode 100644 src/go.mod create mode 100644 src/go.sum rename canbushandling.go => src/internal/canbushandling.go (99%) rename convertfunctions.go => src/internal/convertfunctions.go (99%) rename main.go => src/internal/main.go (99%) rename mqtthandling.go => src/internal/mqtthandling.go (99%) rename receivehandling.go => src/internal/receivehandling.go (98%) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index f72d6d1..4d204d7 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -11,17 +11,19 @@ jobs: - name: Set up Go 1.x uses: actions/setup-go@v2 with: - go-version: ^1.19 + go-version: ^1.22 - name: Check out code into the Go module directory uses: actions/checkout@v2 - name: Get dependencies - run: | - go get -v -t -d ./... + run: go get -v -t -d + working-directory: ./src - name: Build - run: go build -v . + run: go build -v + working-directory: ./src - name: Test - run: go test -v . + run: go test -v + working-directory: ./src diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 81e8ad6..284cbc6 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -20,9 +20,9 @@ jobs: github_token: ${{ secrets.GITHUB_TOKEN }} goos: ${{ matrix.goos }} goarch: ${{ matrix.goarch }} - goversion: 1.19 + goversion: 1.22 binary_name: can2mqtt compress_assets: false - project_path: can2mqtt + project_path: src env: CGO_ENABLED: 0 diff --git a/examples/c3re.csv b/example.csv similarity index 100% rename from examples/c3re.csv rename to example.csv diff --git a/go.mod b/go.mod deleted file mode 100644 index 05a2548..0000000 --- a/go.mod +++ /dev/null @@ -1,15 +0,0 @@ -module github.com/c3re/can2mqtt - -go 1.18 - -require ( - github.com/brutella/can v0.0.2 - github.com/eclipse/paho.mqtt.golang v1.4.1 -) - -require ( - github.com/gorilla/websocket v1.4.2 // indirect - golang.org/x/net v0.17.0 // indirect - golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect - golang.org/x/sys v0.13.0 // indirect -) diff --git a/go.sum b/go.sum deleted file mode 100644 index c2c919f..0000000 --- a/go.sum +++ /dev/null @@ -1,18 +0,0 @@ -github.com/brutella/can v0.0.2 h1:8TyjZrBZSwQwSr5x3U9KtKzGW8HNE/NpUgsNcYDAVIM= -github.com/brutella/can v0.0.2/go.mod h1:NYDxbQito3w4+4DcjWs/fpQ3xyaFdpXw/KYqtZFU98k= -github.com/eclipse/paho.mqtt.golang v1.4.1 h1:tUSpviiL5G3P9SZZJPC4ZULZJsxQKXxfENpMvdbAXAI= -github.com/eclipse/paho.mqtt.golang v1.4.1/go.mod h1:JGt0RsEwEX+Xa/agj90YJ9d9DH2b7upDZMK9HRbFvCA= -github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= -github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/net v0.0.0-20200425230154-ff2c4b7c35a0/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= -golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= -golang.org/x/sync v0.0.0-20210220032951-036812b2e83c h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ= -golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20181213200352-4d1cda033e06/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= -golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/can2mqtt/main.go b/src/can2mqtt.go similarity index 96% rename from can2mqtt/main.go rename to src/can2mqtt.go index 6a48a35..cb3cc5d 100644 --- a/can2mqtt/main.go +++ b/src/can2mqtt.go @@ -3,7 +3,7 @@ package main import ( "fmt" // print - C2M "github.com/c3re/can2mqtt" + C2M "github.com/c3re/can2mqtt/internal" "os" // args ) diff --git a/src/go.mod b/src/go.mod new file mode 100644 index 0000000..c7df202 --- /dev/null +++ b/src/go.mod @@ -0,0 +1,15 @@ +module github.com/c3re/can2mqtt + +go 1.22.2 + +require ( + github.com/brutella/can v0.0.2 + github.com/eclipse/paho.mqtt.golang v1.4.3 +) + +require ( + github.com/gorilla/websocket v1.5.0 // indirect + golang.org/x/net v0.8.0 // indirect + golang.org/x/sync v0.1.0 // indirect + golang.org/x/sys v0.6.0 // indirect +) diff --git a/src/go.sum b/src/go.sum new file mode 100644 index 0000000..60e2da9 --- /dev/null +++ b/src/go.sum @@ -0,0 +1,13 @@ +github.com/brutella/can v0.0.2 h1:8TyjZrBZSwQwSr5x3U9KtKzGW8HNE/NpUgsNcYDAVIM= +github.com/brutella/can v0.0.2/go.mod h1:NYDxbQito3w4+4DcjWs/fpQ3xyaFdpXw/KYqtZFU98k= +github.com/eclipse/paho.mqtt.golang v1.4.3 h1:2kwcUGn8seMUfWndX0hGbvH8r7crgcJguQNCyp70xik= +github.com/eclipse/paho.mqtt.golang v1.4.3/go.mod h1:CSYvoAlsMkhYOXh/oKyxa8EcBci6dVkLCbo5tTC1RIE= +github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= +github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ= +golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= +golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o= +golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20181213200352-4d1cda033e06/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= diff --git a/canbushandling.go b/src/internal/canbushandling.go similarity index 99% rename from canbushandling.go rename to src/internal/canbushandling.go index f450d41..feb3e12 100644 --- a/canbushandling.go +++ b/src/internal/canbushandling.go @@ -1,6 +1,6 @@ // Package can2mqtt contains some tools for bridging a CAN-Interface // and a mqtt-network -package can2mqtt +package internal import ( "fmt" diff --git a/convertfunctions.go b/src/internal/convertfunctions.go similarity index 99% rename from convertfunctions.go rename to src/internal/convertfunctions.go index 531365e..2f36f62 100644 --- a/convertfunctions.go +++ b/src/internal/convertfunctions.go @@ -1,4 +1,4 @@ -package can2mqtt +package internal import ( "encoding/binary" diff --git a/main.go b/src/internal/main.go similarity index 99% rename from main.go rename to src/internal/main.go index a47a7dd..5d2d50a 100644 --- a/main.go +++ b/src/internal/main.go @@ -1,4 +1,4 @@ -package can2mqtt +package internal import ( "bufio" // Reader diff --git a/mqtthandling.go b/src/internal/mqtthandling.go similarity index 99% rename from mqtthandling.go rename to src/internal/mqtthandling.go index 4edabd4..754be1f 100644 --- a/mqtthandling.go +++ b/src/internal/mqtthandling.go @@ -1,4 +1,4 @@ -package can2mqtt +package internal import ( "fmt" diff --git a/receivehandling.go b/src/internal/receivehandling.go similarity index 98% rename from receivehandling.go rename to src/internal/receivehandling.go index d44df8c..6692093 100644 --- a/receivehandling.go +++ b/src/internal/receivehandling.go @@ -1,4 +1,4 @@ -package can2mqtt +package internal import ( "fmt"