Skip to content
This repository has been archived by the owner on Mar 19, 2021. It is now read-only.

Commit

Permalink
fix go
Browse files Browse the repository at this point in the history
  • Loading branch information
M3chD09 committed May 21, 2020
1 parent 7badd7e commit a1f6610
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 20 deletions.
5 changes: 0 additions & 5 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@ on:
pull_request:
branches: [ master ]

defaults:
run:
shell: bash
working-directory: backend

jobs:

build:
Expand Down
2 changes: 1 addition & 1 deletion backend/FileHandle/FileSave.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"log"
"os"

datapack "Robot_Monitor_Web/DataPack"
datapack "Robot_Monitor_Web/backend/DataPack"
)

func jsonLoad(filename string, v interface{}) {
Expand Down
2 changes: 1 addition & 1 deletion backend/SerialHandle/SerialHandle.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"strings"
"time"

datapack "Robot_Monitor_Web/DataPack"
datapack "Robot_Monitor_Web/backend/DataPack"

"go.bug.st/serial.v1"
)
Expand Down
2 changes: 1 addition & 1 deletion backend/SerialHandle/TestPort.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (

"go.bug.st/serial.v1"

datapack "Robot_Monitor_Web/DataPack"
datapack "Robot_Monitor_Web/backend/DataPack"
)

type testPort struct {
Expand Down
6 changes: 3 additions & 3 deletions backend/WebHandle/HandleFunc.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ import (
"strconv"
"strings"

datapack "Robot_Monitor_Web/DataPack"
filehandle "Robot_Monitor_Web/FileHandle"
datapack "Robot_Monitor_Web/backend/DataPack"
filehandle "Robot_Monitor_Web/backend/FileHandle"

serialhandle "Robot_Monitor_Web/SerialHandle"
serialhandle "Robot_Monitor_Web/backend/SerialHandle"
)

func currentSerialPortWebHandler(w http.ResponseWriter, _ *http.Request) {
Expand Down
9 changes: 4 additions & 5 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,15 @@
cd ./frontend
npm install
npm run build
cd ../backend
cp -r ../frontend/dist ./WebPageBuild
cd ..
cp main.go main.go.org
sed -i 's/http.Dir(\".\/WebPage\/\")/assetFS()/g' main.go
sed -i 's/http.Dir(\".\/frontend\/dist\/\")/assetFS()/g' main.go
#wget -q $(awk -F "\"" '/http(.+?)/{print $2}' WebPageBuild/index.html) -P WebPageBuild
#sed -i 's/https[a-zA-Z0-9\:\/\.@\-]*\///g' WebPageBuild/index.html
go get github.com/go-bindata/go-bindata/...
go get github.com/elazarl/go-bindata-assetfs/...
go-bindata -fs -prefix "WebPageBuild/" WebPageBuild/
go-bindata-assetfs WebPageBuild/...
go-bindata -fs -prefix "frontend/dist/" frontend/dist/
go-bindata-assetfs frontend/dist/...
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s" -o Robot_Monitor_Web_linux
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags="-w -s" -o Robot_Monitor_Web_mac
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags="-w -s" -o Robot_Monitor_Web_windows.exe
Expand Down
File renamed without changes.
File renamed without changes.
8 changes: 4 additions & 4 deletions backend/main.go → main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import (
"strconv"
"time"

filehandle "Robot_Monitor_Web/FileHandle"
serialhandle "Robot_Monitor_Web/SerialHandle"
webhandle "Robot_Monitor_Web/WebHandle"
filehandle "Robot_Monitor_Web/backend/FileHandle"
serialhandle "Robot_Monitor_Web/backend/SerialHandle"
webhandle "Robot_Monitor_Web/backend/WebHandle"
)

func main() {
Expand All @@ -31,7 +31,7 @@ func main() {
filehandle.SaveAll()
}
}()
http.Handle("/", http.FileServer(http.Dir("./WebPage/")))
http.Handle("/", http.FileServer(http.Dir("./frontend/dist/")))
webhandle.Reg()
port := ""
if len(os.Args) > 1 {
Expand Down

0 comments on commit a1f6610

Please sign in to comment.