diff --git a/CHANGELOG.md b/CHANGELOG.md index 9b1ad1c..db74669 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file. ## [Unreleased] +## [v0.9.1] - 2021-03-14 +### Added +- Added Dockerfile. + +### Changed +- Disabled CGO in release script. + ## [v0.9.0] - 2020-12-20 ### Added - Added config validation. @@ -86,7 +93,8 @@ than entry in configuration file. ### Added - Initial implementation. -[Unreleased]: https://github.com/gorcon/rcon-cli/compare/v0.9.0...HEAD +[Unreleased]: https://github.com/gorcon/rcon-cli/compare/v0.9.1...HEAD +[v0.9.1]: https://github.com/gorcon/rcon-cli/compare/v0.9.0...v0.9.1 [v0.9.0]: https://github.com/gorcon/rcon-cli/compare/v0.8.1...v0.9.0 [v0.8.1]: https://github.com/gorcon/rcon-cli/compare/v0.8.0-beta.2...v0.8.1 [v0.8.0-beta.2]: https://github.com/gorcon/rcon-cli/compare/v0.8.0-beta...v0.8.0-beta.2 diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..3132df8 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,10 @@ +FROM scratch +MAINTAINER Pavel Korotkiy + +COPY LICENSE / +COPY README.md / +COPY CHANGELOG.md / +COPY rcon.yaml / +COPY rcon-cli /rcon + +CMD ["/rcon"] diff --git a/LICENSE b/LICENSE index a5db1e2..9014e14 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2020 Pavel Korotkiy (outdead) +Copyright (c) 2021 Pavel Korotkiy (outdead) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index aea5211..31f2706 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,7 @@ [![top level coverage](https://gocover.io/_badge/github.com/gorcon/rcon-cli?0)](https://gocover.io/github.com/gorcon/rcon-cli) [![Go Report Card](https://goreportcard.com/badge/github.com/gorcon/rcon-cli)](https://goreportcard.com/report/github.com/gorcon/rcon-cli) [![GitHub All Releases](https://img.shields.io/github/downloads/gorcon/rcon-cli/total)](https://github.com/gorcon/rcon-cli/releases) +[![Docker Pulls](https://img.shields.io/docker/pulls/outdead/rcon.svg)](https://hub.docker.com/r/outdead/rcon) CLI for executing queries on a remote [Source dedicated game server](https://developer.valvesoftware.com/wiki/Source_Dedicated_Server), using the [RCON](https://developer.valvesoftware.com/wiki/Source_RCON_Protocol) protocol. @@ -22,6 +23,10 @@ Download the binary for your platform from the [latest releases](https://github. See [Changelog](CHANGELOG.md) for release details +### Docker + + docker pull outdead/rcon + ## Usage ```text diff --git a/internal/logger/logger.go b/internal/logger/logger.go index 1421ca8..79c5ca2 100644 --- a/internal/logger/logger.go +++ b/internal/logger/logger.go @@ -25,12 +25,14 @@ func OpenFile(name string) (file *os.File, err error) { switch _, err = os.Stat(name); { case err == nil: file, err = os.OpenFile(name, os.O_APPEND|os.O_WRONLY, 0666) + if err != nil { + return file, fmt.Errorf("open: %w", err) + } case os.IsNotExist(err): file, err = os.Create(name) - } - - if err != nil { - return file, fmt.Errorf("open: %w", err) + if err != nil { + return file, fmt.Errorf("create: %w", err) + } } return file, nil diff --git a/release.sh b/release.sh index 5e4da49..f5d9fde 100755 --- a/release.sh +++ b/release.sh @@ -24,8 +24,7 @@ function make_release() { local dir="release/${release_name}" mkdir -p "${dir}" - env GOARCH="${arch}" GOOS="${os}" go build -ldflags "-s -w -X main.Version=${VERSION}" -o "${dir}/rcon${ext}" - #upx-ucl --best "${dir}/rcon${ext}" -o "${dir}/rcon-upx${ext}" + env GOARCH="${arch}" GOOS="${os}" CGO_ENABLED=0 go build -ldflags "-s -w -X main.Version=${VERSION}" -o "${dir}/rcon${ext}" cp LICENSE "${dir}" cp README.md "${dir}" @@ -52,3 +51,5 @@ make_release amd64 linux "rcon-${VERSION}-amd64_linux" make_release 386 windows "rcon-${VERSION}-win32" .exe make_release amd64 windows "rcon-${VERSION}-win64" .exe make_release amd64 darwin "rcon-${VERSION}-amd64_darwin" + +env GOARCH="amd64" GOOS="linux" CGO_ENABLED=0 go build -ldflags "-s -w -X main.Version=${VERSION}"