Skip to content

Commit

Permalink
Merge pull request #20 from noborus/cgo-free
Browse files Browse the repository at this point in the history
Changed to a build that does not use CGO
  • Loading branch information
noborus committed Oct 17, 2023
2 parents 9c3650d + b0a4d8f commit d9e18da
Show file tree
Hide file tree
Showing 6 changed files with 178 additions and 202 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v3
uses: actions/setup-go@v4
with:
go-version: 'stable'
- name: Run GoReleaser
Expand Down
36 changes: 22 additions & 14 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,31 @@ before:
- go generate ./...
builds:
- env:
- CGO_ENABLED=1
- CGO_ENABLED=0
goos:
- linux
goarch:
- amd64
overrides:
- goos: linux
goarch: amd64
env:
- CC=gcc
- goos: linux
goarch: arm64
env:
- CC=aarch64-linux-gnu-gcc
- windows
- darwin
id: "psutilsql"
main: ./cmd/psutilsql
ignore:
- goos: windows
goarch: "386"

archives:
- format: tar.gz
# this name template makes the OS and Arch compatible with the results of uname.
name_template: >-
{{ .ProjectName }}_
{{- title .Os }}_
{{- if eq .Arch "amd64" }}x86_64
{{- else if eq .Arch "386" }}i386
{{- else }}{{ .Arch }}{{ end }}
{{- if .Arm }}v{{ .Arm }}{{ end }}
# use zip for windows archives
format_overrides:
- goos: windows
format: zip
checksum:
name_template: 'checksums.txt'
snapshot:
Expand All @@ -39,7 +46,7 @@ changelog:
brews:
-
name: psutilsql
tap:
repository:
owner: noborus
name: homebrew-tap
token: "{{ .Env.TAP_GITHUB_TOKEN }}"
Expand All @@ -48,6 +55,7 @@ brews:
email: [email protected]
homepage: https://github.com/noborus/psutilsql
description: "CLI tool that can be processed by SQL using"
# modelines, feel free to remove those if you don't want/use them:
# The lines beneath this are called `modelines`. See `:help modeline`
# Feel free to remove those if you don't want/use them.
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
# vim: set ts=2 sw=2 tw=0 fo=cnqoj
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ test: $(SRCS)
build: $(BINARY_NAME)

$(BINARY_NAME): $(SRCS)
go build -ldflags $(LDFLAGS) -o $(BINARY_NAME) ./cmd/psutilsql
CGO_ENABLED=0 go build -ldflags $(LDFLAGS) -o $(BINARY_NAME) ./cmd/psutilsql

install:
go install -ldflags $(LDFLAGS) ./cmd/psutilsql
CGO_ENABLED=0 go install -ldflags $(LDFLAGS) ./cmd/psutilsql

clean:
rm -f $(BINARY_NAME)
Expand Down
4 changes: 3 additions & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func init() {
// Cobra also supports local flags, which will only run
// when this action is called directly.
rootCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
rootCmd.PersistentFlags().StringVarP(&OutFormat, "OutFormat", "o", "at", "output format=at|csv|ltsv|json|jsonl|tbln|raw|md|vf")
rootCmd.PersistentFlags().StringVarP(&OutFormat, "OutFormat", "o", "at", "output format=at|csv|ltsv|json|jsonl|tbln|raw|md|vf|yaml")
rootCmd.PersistentFlags().StringVarP(&Delimiter, "Delimiter", "d", ",", "output delimiter (CSV only)")
rootCmd.PersistentFlags().BoolVarP(&Header, "Header", "O", false, "output header (CSV only)")
rootCmd.PersistentFlags().StringVarP(&Query, "Query", "q", "", "query")
Expand All @@ -94,6 +94,8 @@ func outFormat() trdsql.Writer {
format = trdsql.AT
case "VF":
format = trdsql.VF
case "YAML":
format = trdsql.YAML
default:
format = trdsql.AT
}
Expand Down
61 changes: 55 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,13 +1,62 @@
module github.com/noborus/psutilsql

go 1.16
go 1.19

require (
github.com/kr/pretty v0.2.0 // indirect
github.com/noborus/guesswidth v0.3.2 // indirect
github.com/noborus/trdsql v0.11.1
github.com/noborus/trdsql v0.12.1
github.com/shirou/gopsutil v3.21.11+incompatible
github.com/spf13/cobra v1.7.0
github.com/tklauser/go-sysconf v0.3.11 // indirect
github.com/yusufpapurcu/wmi v1.2.2 // indirect
)

require (
github.com/araddon/dateparse v0.0.0-20210429162001-6b43995a97de // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/fatih/color v1.15.0 // indirect
github.com/go-ole/go-ole v1.3.0 // indirect
github.com/go-sql-driver/mysql v1.7.1 // indirect
github.com/goccy/go-yaml v1.11.2 // indirect
github.com/google/uuid v1.3.1 // indirect
github.com/iancoleman/orderedmap v0.3.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/itchyny/gojq v0.12.13 // indirect
github.com/itchyny/timefmt-go v0.1.5 // indirect
github.com/jwalton/gchalk v1.3.0 // indirect
github.com/jwalton/go-supportscolor v1.2.0 // indirect
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
github.com/klauspost/compress v1.17.1 // indirect
github.com/kr/pretty v0.2.0 // indirect
github.com/lib/pq v1.10.9 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/mattn/go-runewidth v0.0.15 // indirect
github.com/mattn/go-sqlite3 v1.14.17 // indirect
github.com/multiprocessio/go-sqlite3-stdlib v0.0.0-20220822170115-9f6825a1cd25 // indirect
github.com/noborus/guesswidth v0.3.4 // indirect
github.com/noborus/tbln v0.0.2 // indirect
github.com/olekukonko/tablewriter v0.0.5 // indirect
github.com/pierrec/lz4 v2.6.1+incompatible // indirect
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
github.com/rivo/uniseg v0.4.4 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/tklauser/go-sysconf v0.3.12 // indirect
github.com/tklauser/numcpus v0.6.1 // indirect
github.com/ulikunitz/xz v0.5.11 // indirect
github.com/yusufpapurcu/wmi v1.2.3 // indirect
golang.org/x/crypto v0.14.0 // indirect
golang.org/x/mod v0.13.0 // indirect
golang.org/x/sys v0.13.0 // indirect
golang.org/x/term v0.13.0 // indirect
golang.org/x/tools v0.14.0 // indirect
golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect
gonum.org/v1/gonum v0.14.0 // indirect
lukechampine.com/uint128 v1.3.0 // indirect
modernc.org/cc/v3 v3.41.0 // indirect
modernc.org/ccgo/v3 v3.16.15 // indirect
modernc.org/libc v1.24.1 // indirect
modernc.org/mathutil v1.6.0 // indirect
modernc.org/memory v1.7.2 // indirect
modernc.org/opt v0.1.3 // indirect
modernc.org/sqlite v1.26.0 // indirect
modernc.org/strutil v1.2.0 // indirect
modernc.org/token v1.1.0 // indirect
)
Loading

0 comments on commit d9e18da

Please sign in to comment.