Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

- optimization suggestion for #372 #373

Merged
merged 1 commit into from
Apr 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
* text=auto
* text eol=lf

*.png binary
*.jpg binary
5 changes: 5 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,8 @@ updates:
labels:
- c:deps
- golang
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
time: "07:00"
40 changes: 32 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,32 @@ env:
CGO_ENABLED: 0 # Build statically linked binaries

jobs:
fmt_and_vet:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Install Go
uses: actions/setup-go@v5
with:
go-version: 1.22

- name: Check vet
run: |
go vet ./...

- name: Check fmt
run: |
go fmt ./...
if [[ -z "$(git status --porcelain)" ]]; then
echo "Formatting is consistent with 'go fmt'."
else
echo "Run 'go fmt ./...' to automatically apply standard Go style to all packages."
git status --porcelain
exit 1
fi

integration_tests_linux:
strategy:
matrix:
Expand All @@ -31,12 +57,13 @@ jobs:
- name: Build code
run: go build -v ./...

- name: Running test
- name: Running unit tests
run: |
set -e
go get -v -t -d ./...
go vet -tests=false ./...
go test -v ./...

- name: Running integration tests
run: |
set -e
mkdir -p build
go build -v -o build/tfswitch
mkdir `pwd`/bin/
Expand All @@ -60,9 +87,6 @@ jobs:
with:
go-version: ${{ matrix.go_version }}

- name: Build code
run: go build -v ./...

- name: Running test
- name: Running unit tests
run: |
go test -v ./...
58 changes: 0 additions & 58 deletions .travis.yml

This file was deleted.

7 changes: 4 additions & 3 deletions lib/dir_perm.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
//go:build !windows
// +build !windows

package lib

import "golang.org/x/sys/unix"

//Check if user has permission to directory :
//dir=path to file
//return bool
// Check if user has permission to directory :
// dir=path to file
// return bool
func CheckDirWritable(dir string) bool {
return unix.Access(dir, unix.W_OK) == nil
}