diff --git a/.devcontainer/Containerfile b/.devcontainer/Containerfile new file mode 100644 index 0000000..c8b3d66 --- /dev/null +++ b/.devcontainer/Containerfile @@ -0,0 +1,3 @@ +FROM docker.io/library/fedora:latest + +RUN dnf update -y && dnf install device-mapper-devel gpgme-devel btrfs-progs-devel golang-go golint golang-honnef-tools golang-mvdan-gofumpt && dnf clean all -y diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..20bcf5c --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,6 @@ +// README at: https://github.com/devcontainers/templates/tree/main/src/go +{ + "name": "Go", + "dockerFile": ".devcontainer/Containerfile", + "workspaceMount": ".", +} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..37ac288 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,32 @@ +--- +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v2.3.0 + hooks: + - id: check-yaml + - id: end-of-file-fixer + - id: trailing-whitespace + - id: mixed-line-ending + - id: check-symlinks + - id: check-added-large-files + - repo: https://github.com/golangci/golangci-lint + rev: v1.56.2 + hooks: + - id: golangci-lint-full + - repo: https://github.com/jumanjihouse/pre-commit-hook-yamlfmt + rev: 0.2.3 + hooks: + - id: yamlfmt + - repo: https://github.com/mrtazz/checkmake.git + rev: 0.2.2 + hooks: + - id: checkmake + - repo: https://github.com/Bahjat/pre-commit-golang + rev: v1.0.2 + hooks: + - id: go-fmt-import + - id: go-vet + - id: go-lint + - id: go-unit-tests + - id: gofumpt # requires github.com/mvdan/gofumpt + - id: go-static-check # install https://staticcheck.io/docs/ diff --git a/bext-rpm-distrobox.ini b/bext-rpm-distrobox.ini index 33c5bfc..c1cfefb 100644 --- a/bext-rpm-distrobox.ini +++ b/bext-rpm-distrobox.ini @@ -1,11 +1,9 @@ [bext-devbox] additional_packages="rpkg rpmdevtools copr-cli tito rpm-build" -image=fedora:latest +image=docker.io/library/fedora:latest init=false start_now=true -init_hooks="touch /init-normal" nvidia=true -pre_init_hooks="touch /pre-init" pull=true root=false replace=false diff --git a/build-distrobox.ini b/build-distrobox.ini index 860a38b..8e8187c 100644 --- a/build-distrobox.ini +++ b/build-distrobox.ini @@ -1,11 +1,9 @@ [build-devbox] -additional_packages="device-mapper-devel gpgme-devel btrfs-progs-devel golang-go" -image=fedora:latest +additional_packages="device-mapper-devel gpgme-devel btrfs-progs-devel golang-go golint golang-honnef-tools golang-mvdan-gofumpt" +image=docker.io/library/fedora:latest init=false start_now=true -init_hooks="touch /init-normal" nvidia=true -pre_init_hooks="touch /pre-init" pull=true root=false replace=false diff --git a/flake.nix b/flake.nix index 276dd21..5d0b973 100644 --- a/flake.nix +++ b/flake.nix @@ -31,7 +31,7 @@ in { formatter = pkgs.alejandra; devShells.default = pkgs.mkShell { - packages = with pkgs; [cobra-cli gopls eclint apko melange] ++ bext_deps.build ++ bext_deps.runtime; + packages = with pkgs; [cobra-cli gopls eclint apko melange golangci-lint errcheck go-tools] ++ bext_deps.build ++ bext_deps.runtime; }; packages = { default = self.packages.${system}.bext;