Skip to content
This repository has been archived by the owner on Apr 30, 2024. It is now read-only.

Commit

Permalink
fix(docs,tools): correct Windows installation command; remove `tools.…
Browse files Browse the repository at this point in the history
…go` (#9)

* fix(docs): update Windows installation instructions

* chore(tools): remove tools.go

* chore: update formatting to separate local packages

* fix: use correct repository
  • Loading branch information
coffeebeats authored Nov 10, 2023
1 parent f9851af commit ca9940f
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 2,078 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/check-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,16 @@ jobs:
id: format
continue-on-error: true
run: |
go install golang.org/x/tools/cmd/goimports
go install golang.org/x/tools/cmd/goimports@latest
test -z $(gofmt -l .)
test -z $(goimports -l .)
test -z $(goimports -local github.com/coffeebeats/gdpack -l .)
- name: Fix formatting of source code
if: steps.format.outcome == 'failure'
run: |
gofmt -w .
goimports -w .
goimports -local github.com/coffeebeats/gdpack -w .
# See https://github.com/orgs/community/discussions/26560#discussioncomment-3531273
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
Expand Down
14 changes: 12 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
{
"git.branchProtection": ["main"],

/* ------------------------------ Language: Go ------------------------------ */

"[go]": {
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
Expand All @@ -11,6 +15,12 @@
"source.organizeImports": true
}
},
"git.branchProtection": ["main"],
"go.lintTool": "golangci-lint"

/* ----------------------------- Extensions: Go ----------------------------- */

"go.lintTool": "golangci-lint",
"gopls": {
"formatting.gofumpt": false,
"formatting.local": "github.com/coffeebeats/gdpack"
}
}
22 changes: 13 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ These instructions will help you install `gdpack` and manage addons for your _Go

### **Example usage**

TODO

### **Installation**

See [docs/installation.md](./docs/installation.md#installation) for detailed instructions on how to download `gdpack`.
Expand All @@ -24,28 +26,30 @@ See [docs/commands.md](./docs/commands.md) for a detailed reference on how to us

## **Development**

### Setup

The following instructions outline how to get the project set up for local development:

1. [Follow the instructions](https://go.dev/doc/install) to install Go (see [go.mod](./go.mod) for the minimum required version).
2. Clone the [coffeebeats/gdpack](https://github.com/coffeebeats/gdpack) repository.
3. Install the [required tools](./tools.go) using the following command ([see this article](https://www.alexedwards.net/blog/using-go-run-to-manage-tool-dependencies) for more explanation):
3. Install the tools [used below](#code-submission) by following each of their specific installation instructions.

```sh
cat tools.go | grep _ | grep -v '//' | awk -F'"' '{print $2}' | xargs -tI % go install %
```
### Code submission

When submitting code for review, ensure the following requirements are met:

1. The project is correctly formatted using [go fmt](https://go.dev/blog/gofmt):
> **NOTE:** These instructions do not persist the tools to your development environment. When regular use is required, follow each tool's individual instructions to install permanent versions.
1. The project is correctly formatted using [goimports](https://pkg.go.dev/golang.org/x/tools/cmd/goimports):

```sh
go fmt ./...
go run golang.org/x/tools/cmd/goimports@latest -w .
```

2. All [golangci-lint](https://golangci-lint.run/) linter warnings are addressed:

```sh
golangci-lint run ./...
go run github.com/golangci/golangci-lint/cmd/golangci-lint@latest run ./...
```

3. All unit tests pass and no data races are found:
Expand All @@ -54,10 +58,10 @@ When submitting code for review, ensure the following requirements are met:
go test -race ./...
```

4. The `gdpack` binary successfully compiles (release artifacts will be available at `./dist`):
4. The `gdpack` binary successfully compiles with [goreleaser](https://goreleaser.com/) (release artifacts will be available at `./dist`):

```sh
goreleaser release --clean --skip=publish --snapshot
go run github.com/goreleaser/goreleaser@latest release --clean --skip=publish --snapshot
```

## **Contributing**
Expand Down
23 changes: 10 additions & 13 deletions docs/installation.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@

# **Installation**

The easiest way to install `gdpack` is by using the pre-built binaries. These can be manually downloaded and configured, but automated installation scripts are provided and recommended.

Alternatively, you can install `gdpack` from source using the latest supported version of [Go](https://go.dev/). See [Install from source](#install-from-source) for more details.

## **Pre-built binaries**
## **Pre-built binaries (recommended)**

> ⚠️ **WARNING:** It's good practice to inspect an installation script prior to execution. The scripts are included in this repository and can be reviewed prior to use.
### **Linux/MacOS (recommended)**
### **Linux/MacOS**

```sh
curl https://raw.githubusercontent.com/coffeebeats/gdpack/main/scripts/install.sh | sh
```

### **Windows (recommended)**
### **Windows**

#### **Git BASH for Windows**

If you're using [Git BASH for Windows](https://gitforwindows.org/) follow the recommended [Linux/MacOS](#linuxmacos-recommended) instructions.
If you're using [Git BASH for Windows](https://gitforwindows.org/) follow the recommended [Linux/MacOS](#linuxmacos) instructions.

#### **Powershell**

Expand All @@ -35,34 +34,32 @@ Invoke-WebRequest `
-UseBasicParsing `
-Uri "https://raw.githubusercontent.com/coffeebeats/gdpack/main/scripts/install.ps1" `
-OutFile "./install-gdpack.ps1"; `
&"./scripts/install-gdpack.ps1"
&"./install-gdpack.ps1"; `
Remove-Item "./install-gdpack.ps1"
```
### **Manual download**
> **NOTE:** The instructions below provide `bash`-specific commands for a _Linux_-based system. While these won't work in _PowerShell_, the process will be similar.
>**NOTE:** The instructions below provide `bash`-specific commands for a _Linux_-based system. While these won't work in _Powershell_, the process will be similar.
1. Download a prebuilt binary from the corresponding GitHub release.
1. Download a prebuilt binary from the corresponding GitHub release. Set `VERSION`, `OS`, and `ARCH` to the desired values.
```sh
# Set '$VERSION', '$OS', and '$ARCH' to the desired values.
VERSION=0.0.0 OS=linux ARCH=x86_64; \
curl -LO https://github.com/coffeebeats/gdpack/releases/download/v$VERSION/gdpack-$VERSION-$OS-$ARCH.tar.gz
```
2. Extract the downloaded archive.
2. Extract the downloaded archive. To customize the `gdpack` install location, set `GDPACK_HOME` to the desired location (defaults to `$HOME/.gdpack` on Linux/MacOS).
```sh
# Set '$GDPACK_HOME' to the desired location (defaults to '$HOME/.gdpack' on Linux/MacOS).
GDPACK_HOME=$HOME/.gdpack; \
mkdir -p $GDPACK_HOME/bin && \
tar -C $GDPACK_HOME/bin -xf gdpack-$VERSION-$OS-$ARCH.tar.gz
```
3. Export the `GDPACK_HOME` environment variable and add `$GDPACK_HOME/bin` to `$PATH`.
3. Export the `GDPACK_HOME` environment variable and add `$GDPACK_HOME/bin` to `PATH`. Add the following to your shell profile script (e.g. in `.bashrc`, `.zshenv`, `.profile`, or something similar).
```sh
# In '.bashrc' or something similar ('$GDPACK_HOME' can be customized).
export GDPACK_HOME="$HOME/.gdpack"
export PATH="$GDPACK_HOME/bin:$PATH"
```
Expand Down
Loading

0 comments on commit ca9940f

Please sign in to comment.