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

Develop #8

Merged
merged 2 commits into from
Jan 5, 2025
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
36 changes: 36 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"name": "enumflag",
"portsAttributes": {
"6060": {
"label": "enumflag package documentation",
"onAutoForward": "notify",
"protocol": "http"
}
},
"image": "mcr.microsoft.com/devcontainers/base:ubuntu-24.04",
"features": {
"ghcr.io/thediveo/devcontainer-features/local-pkgsite:0": {},
"ghcr.io/thediveo/devcontainer-features/goreportcard:0": {},
"ghcr.io/thediveo/devcontainer-features/go-mod-upgrade:0": {},
"ghcr.io/thediveo/devcontainer-features/gocover:0": {
"num-programs": "1",
"race": true,
"verbose": true,
"html": true
}
},
"remoteEnv": {
"GOPATH": "/home/vscode/go",
"PATH": "/home/vscode/go/bin:/go/bin:/usr/local/go/bin:${localEnv:PATH}"
},
"customizations": {
"vscode": {
"extensions": [
"stkb.rewrap",
"brunnerh.insert-unicode",
"mhutchie.git-graph",
"ms-vscode.makefile-tools"
]
}
}
}
34 changes: 0 additions & 34 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,40 +45,6 @@
"kind": "build",
"isDefault": true
}
},
{
"label": "View Go module documentation",
"dependsOrder": "parallel",
"dependsOn": [
"don't Run Task this! -- pkgsite service",
"don't Run Task this! -- view pkgsite"
],
"problemMatcher": []
},
{
"label": "don't Run Task this! -- view pkgsite",
"command": "${input:pkgsite}",
},
{
"label": "don't Run Task this! -- pkgsite service",
"type": "shell",
"command": "${workspaceFolder}/scripts/pkgsite.sh",
"presentation": {
"echo": true,
"reveal": "always",
"focus": false,
"panel": "shared",
"showReuseMessage": false,
"close": true,
}
}
],
"inputs": [
{
"id": "pkgsite",
"type": "command",
"command": "simpleBrowser.api.open",
"args": "http://localhost:6060/github.com/thediveo/enumflag/v2"
}
]
}
20 changes: 6 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,13 @@ help: ## list available targets
clean: ## cleans up build and testing artefacts
rm -f coverage.*

coverage: ## gathers coverage and updates README badge
@scripts/cov.sh

pkgsite: ## serves Go documentation on port 6060
@echo "navigate to: http://localhost:6060/github.com/thediveo/enumflag/v2"
@scripts/pkgsite.sh

report: ## run goreportcard on this module
@scripts/goreportcard.sh

test: ## run unit tests
go test -v -p=1 -race ./...

vuln: ## runs govulncheck
@scripts/vuln.sh
report: ## run goreportcard-cli on this module
# from ghcr.io/thediveo/devcontainer-features/goreportcard
goreportcard-cli -v ./..

chores: ## updates Go binaries and NPM helper packages if necessary
@scripts/chores.sh
coverage: ## gathers coverage and updates README badge
# from ghcr.io/thediveo/devcontainer-features/gocover
gocover
35 changes: 19 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -344,14 +344,23 @@ func Example_slice() {
}
```

## DevContainer

First method:

1. in VSCode: Ctrl+Shift+P, "Dev Containers: Open Workspace in Container..."
2. select `enumflag.code-workspace` and off you go...

Second method:

1. In VSCode: Ctrl+Shift+P, "Dev Containers: Clone Repository in Container Volume..."
2. select "Github"
3. enter "thediveo/enumflag" and off you go...

## VSCode Tasks

The included `enumflag.code-workspace` defines the following tasks:

- **View Go module documentation** task: installs `pkgsite`, if not done already
so, then starts `pkgsite` and opens VSCode's integrated ("simple") browser to
show the go-plugger/v2 documentation.

- **Build workspace** task: builds all, including the shared library test
plugin.

Expand All @@ -374,24 +383,18 @@ The included `enumflag.code-workspace` defines the following tasks:

## Make Targets

- `make`: lists all targets.
- `make coverage`: runs all tests with coverage and then **updates the coverage
badge in `README.md`**.
- `make pkgsite`: installs [`x/pkgsite`](golang.org/x/pkgsite/cmd/pkgsite), as
well as the [`browser-sync`](https://www.npmjs.com/package/browser-sync) and
[`nodemon`](https://www.npmjs.com/package/nodemon) npm packages first, if not
already done so. Then runs the `pkgsite` and hot reloads it whenever the
documentation changes.
- `make report`: installs
[`@gojp/goreportcard`](https://github.com/gojp/goreportcard) if not yet done
so and then runs it on the code base.
- `make`: lists available targets.
- `make test`: runs all tests.
- `make coverage`: deprecated, use the `gocover` CLI command in the devcontainer
instead.
- `make report`: deprecated, use the `goreportcard-cli` CLI command in the
devcontainer instead.

## Contributing

Please see [CONTRIBUTING.md](CONTRIBUTING.md).

## Copyright and License

`lxkns` is Copyright 2020, 2023 Harald Albrecht, and licensed under the Apache
`lxkns` is Copyright 2020, 2025 Harald Albrecht, and licensed under the Apache
License, Version 2.0.
23 changes: 0 additions & 23 deletions scripts/chores.sh

This file was deleted.

33 changes: 0 additions & 33 deletions scripts/cov.sh

This file was deleted.

19 changes: 0 additions & 19 deletions scripts/goreportcard.sh

This file was deleted.

25 changes: 0 additions & 25 deletions scripts/pkgsite.sh

This file was deleted.

16 changes: 0 additions & 16 deletions scripts/vuln.sh

This file was deleted.

Loading