Skip to content

Commit 02ae37b

Browse files
authored
Merge pull request leoleovich#28 from leoleovich/windows
Make grafsy windows compatible
2 parents 4dc6d83 + 833d120 commit 02ae37b

File tree

4 files changed

+35
-30
lines changed

4 files changed

+35
-30
lines changed

.github/workflows/tests.yml

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ name: Tests
22

33
on:
44
push:
5-
branches: [ master ]
5+
branches: [master]
66
pull_request:
7-
branches: [ master ]
7+
branches: [master]
88

99
jobs:
1010

@@ -14,34 +14,34 @@ jobs:
1414
strategy:
1515
matrix:
1616
go:
17-
- ^1.13
18-
- ^1.14
17+
- ^1.19
18+
- ^1.20
1919
steps:
2020

21-
- name: Set up Go 1.x
22-
uses: actions/setup-go@v2
23-
with:
24-
go-version: ${{ matrix.go }}
21+
- name: Set up Go 1.x
22+
uses: actions/setup-go@v2
23+
with:
24+
go-version: ${{ matrix.go }}
2525

26-
- name: Check out code into the Go module directory
27-
uses: actions/checkout@v2
26+
- name: Check out code into the Go module directory
27+
uses: actions/checkout@v2
2828

29-
- name: Install dependencies
30-
run: |
31-
sudo apt-get install -y libacl1-dev
32-
go get golang.org/x/lint/golint
29+
- name: Install dependencies
30+
run: |
31+
sudo apt-get install -y libacl1-dev
32+
GO111MODULE=off go get golang.org/x/lint/golint
3333
34-
- name: Test
35-
run: |
36-
make test
37-
golint ./...
34+
- name: Test
35+
run: |
36+
make test
37+
golint ./...
3838
39-
- name: Build and run version
40-
run: |
41-
make VERSION=testing-version clean build
42-
./build/grafsy -v
43-
CGO_ENABLED=0 make GO_FLAGS='-tags noacl' VERSION=testing-version clean build
44-
./build/grafsy -v
39+
- name: Build and run version
40+
run: |
41+
make VERSION=testing-version clean build
42+
./build/grafsy -v
43+
CGO_ENABLED=0 make GO_FLAGS='-tags noacl' VERSION=testing-version clean build
44+
./build/grafsy -v
4545
4646
build:
4747
name: Build packages
@@ -115,4 +115,4 @@ jobs:
115115
- name: Test rpm
116116
if: ${{ contains(matrix.os, 'centos') }}
117117
run: |
118-
yum -y install libacl; rpm -i grafsy-0.0.0.1*rpm
118+
rpm -i grafsy-0.0.0.1*rpm

Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,12 @@ build/$(NAME): $(NAME)/main.go
4949
build/$(NAME)-client: $(NAME)-client/main.go
5050
$(GO_BUILD)
5151

52+
build/$(NAME).exe: $(NAME)/main.go
53+
GOOS=windows $(GO_BUILD)
54+
55+
build/$(NAME)-client.exe: $(NAME)-client/main.go
56+
GOOS=windows $(GO_BUILD)
57+
5258
#########################################################
5359
# Prepare artifact directory and set outputs for upload #
5460
#########################################################

config.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ package grafsy
22

33
import (
44
"fmt"
5-
"github.com/BurntSushi/toml"
6-
"github.com/pkg/errors"
75
"log"
86
"net"
97
"os"
108
"path/filepath"
119
"regexp"
1210
"strings"
13-
"syscall"
11+
12+
"github.com/BurntSushi/toml"
13+
"github.com/pkg/errors"
1414
)
1515

1616
// ConfigPath is the default path to the configuration file
@@ -170,14 +170,12 @@ func (conf *Config) prepareEnvironment() error {
170170
Check if directories for temporary files exist.
171171
This is especially important when your metricDir is in /tmp.
172172
*/
173-
oldUmask := syscall.Umask(0)
174173

175174
if _, err := os.Stat(conf.MetricDir); os.IsNotExist(err) {
176175
os.MkdirAll(conf.MetricDir, 0777|os.ModeSticky)
177176
} else {
178177
os.Chmod(conf.MetricDir, 0777|os.ModeSticky)
179178
}
180-
syscall.Umask(oldUmask)
181179

182180
/*
183181
Unfortunately some people write to MetricDir with random permissions.

config_windows.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
config_freebsd.go

0 commit comments

Comments
 (0)