Compare commits

..

8 Commits

Author SHA1 Message Date
be97641245
flake: exclude all non-go files
All checks were successful
continuous-integration/drone/push Build is passing
2022-07-08 18:19:46 +02:00
d2b5afe907
flake,ci: reenable GOPROXY var default
All checks were successful
continuous-integration/drone/push Build is passing
...mainly due to arbitrarily failing ci builds, as this doesn't appear
to affect local builds/nix builds on remote builders, just fresh builds
in the ci.
the explanation for why this is happening might be that certain package
VCS's don't allow many/frequent connections from IP ranges other than
GOPROXY's (Google's).
that is sheer speculation, though.
however, it is still true that there are "no" failed ci builds with
GOPROXY env var set to its default value (left untouched), which does
indeed indicate that the above mentioned might be the root cause of the
issue after all.

this commit reverts:
    * f3e481395e
and partially reverts:
    * 14ba7b18bf

GOPROXY=direct has been kept for `nix-shell`/`nix develop` environments
as that is not where it poses an issue.
2022-07-08 17:13:13 +02:00
f58122320b
flake: add ${projname} var instead of a literal
All checks were successful
continuous-integration/drone/push Build is passing
2022-07-07 22:47:43 +02:00
06485ba003
golangci-lint: rm prealloc,{rowserr,sqlclose}check
All checks were successful
continuous-integration/drone/push Build is passing
2022-06-14 14:37:35 +02:00
8ed7525297
pre-commit: run tidy earlier [skip ci] 2022-06-14 13:43:31 +02:00
e11fd7fb72
pre-commit: rm govet,go-cyclo
...since they are both being run as part of golangci-lint checks

[skip ci]
2022-06-14 13:38:33 +02:00
4c67075f5f
flake: set formatter (for all supported systems)
All checks were successful
continuous-integration/drone/push Build is passing
2022-06-13 23:28:52 +02:00
103bbfa528
flake(goModule): filter out non-pertinent files...
All checks were successful
continuous-integration/drone/push Build is passing
...such as flake files or {shell,default}.nix to reduce the necessity to
rebuild (when using `nix build`) after each change, even to non-go
files. more files can be added to an exclude list in the future.
2022-06-13 17:39:46 +02:00
5 changed files with 57 additions and 53 deletions

@ -7,39 +7,11 @@ def main(ctx):
"kind": "pipeline",
"type": "docker",
"name": "golangci-lint",
"clone": {"disable": True},
"environment": {
"GOPROXY": "direct"
},
"steps": [
{
"name": "skip-check",
"image": "docker.io/immawanderer/drone-skip-pipeline:linux-amd64",
"pull": "always",
"settings": {
"rules": [
"*.go",
"*.sum",
"*.mod",
".golangci.yml"
]
},
},
{
"name": "clone",
"image": "docker.io/alpine/git",
"pull": "always",
"depends_on": ["skip-check"],
"commands": [
"git clone ${DRONE_GIT_HTTP_URL} .",
"git checkout ${DRONE_COMMIT}"
]
},
{
"name": "golangci-lint",
"image": "docker.io/immawanderer/archlinux-go-fyne:linux-amd64",
"pull": "always",
"depends_on": ["clone"],
"commands": [
"curl -sSfL " +
"https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh"+
@ -58,9 +30,6 @@ def main(ctx):
"node": {
"r": "w"
},
"environment": {
"GOPROXY": "direct"
},
"steps": [
{
"name": "pull nix",
@ -307,9 +276,6 @@ def main(ctx):
"node": {
"r": "w"
},
"environment": {
"GOPROXY": "direct"
},
"steps": [
{
"name": "pull archlinux",
@ -387,9 +353,6 @@ def main(ctx):
"node": {
"r": "w"
},
"environment": {
"GOPROXY": "direct"
},
"steps": [
{
"name": "pull fedora",

@ -34,10 +34,8 @@ linters:
- ineffassign
# - ifshort
- misspell
- prealloc
# - prealloc # disable for now as it might be premature optimisation
- revive
- rowserrcheck
- sqlclosecheck
- unconvert
- unparam
- varcheck

@ -45,13 +45,10 @@ repos:
- repo: https://github.com/dnephin/pre-commit-golang
rev: v0.5.0
hooks:
- id: go-vet
- id: go-mod-tidy
- id: go-unit-tests
- id: go-cyclo
args: [-over=15]
- id: golangci-lint
- id: go-build
- id: go-mod-tidy
- repo: local
hooks:
- id: nix-build

@ -16,6 +16,21 @@
"type": "github"
}
},
"nix-filter": {
"locked": {
"lastModified": 1653590866,
"narHash": "sha256-E4yKIrt/S//WfW5D9IhQ1dVuaAy8RE7EiCMfnbrOC78=",
"owner": "numtide",
"repo": "nix-filter",
"rev": "3e81a637cdf9f6e9b39aeb4d6e6394d1ad158e16",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "nix-filter",
"type": "github"
}
},
"nixgl": {
"inputs": {
"nixpkgs": [
@ -55,6 +70,7 @@
"root": {
"inputs": {
"flake-compat": "flake-compat",
"nix-filter": "nix-filter",
"nixgl": "nixgl",
"nixpkgs": "nixpkgs"
}

@ -10,11 +10,17 @@
flake = false;
inputs.nixpkgs.follows = "nixpkgs";
};
nix-filter = {
url = "github:numtide/nix-filter";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixgl, nixpkgs, ... }:
outputs = { self, nixgl, nix-filter, nixpkgs, ... }:
let
projname = "go-xkcdreader";
# to work with older version of flakes
lastModifiedDate =
self.lastModifiedDate or self.lastModified or "19700101";
@ -39,6 +45,10 @@
});
in
rec {
formatter = forAllSystems (system:
nixpkgsFor.${system}.nixpkgs-fmt
);
packages = forAllSystems (system:
let
pkgs = nixpkgsFor.${system};
@ -46,7 +56,7 @@
in
rec {
go-xkcdreader = with pkgs; buildGoModule rec {
pname = "go-xkcdreader";
pname = "${projname}";
buildInputs = [
gcc
libglvnd # instead of libGL
@ -67,7 +77,7 @@
nativeBuildInputs = [ pkgconfig ];
overrideModAttrs = _: {
GOPROXY = "direct";
# GOPROXY = "direct";
};
inherit version;
@ -83,15 +93,35 @@
modSha256 = lib.fakeSha256;
# dont't forget to update vendorSha256 whenever go.mod or go.sum change
vendorSha256 = "sha256-gaIoacCs0PcvmFW8dQOFUb9KU1u6KUiFmGQ/ERcVwjc=";
vendorSha256 = "sha256-LvdcTbj8cFlaIBsq1VLfLF2Tu9HiZzGO8igD766nMLE=";
# In 'nix develop', we don't need a copy of the source tree
# in the Nix store.
src = lib.cleanSource ./.;
src = nix-filter.lib.filter {
root = lib.cleanSource ./.;
exclude = [
./flake.nix
./flake.lock
./default.nix
./shell.nix
./check-fmt
./README.md
./LICENSE
./.drone.starlark
./.envrc
./.example.vimrc
./.gitattributes
./.gitignore
./.golangci.yml
./.pre-commit-config.yaml
];
};
meta = {
description = "an offline-capable xkcd webcomic reader written in Go";
homepage = "https://git.dotya.ml/wanderer/go-xkcdreader";
homepage = "https://git.dotya.ml/wanderer/${projname}";
license = lib.licenses.gpl3;
maintainers = [ "wanderer" ];
platforms = lib.platforms.linux ++ lib.platforms.darwin;
@ -105,7 +135,7 @@
go-xkcdreader = {
type = "app";
program =
"${self.packages.${system}.go-xkcdreader}/bin/go-xkcdreader";
"${self.packages.${system}.${projname}}/bin/${projname}";
};
default = go-xkcdreader;
});
@ -138,7 +168,7 @@
nix-store --query --references $(nix-instantiate shell.nix) | \
xargs nix-store --realise | \
xargs nix-store --query --requisites | \
cachix push go-xkcdreader
cachix push ${projname}
'';
add-license = pkgs.writeShellScriptBin "add-license" ''
go run github.com/google/addlicense@v1.0.0 -v \
@ -149,7 +179,7 @@
{
default = with pkgs; mkShell
{
name = "go-xkcdreader-" + version;
name = "${projname}-" + version;
GOFLAGS = "-buildmode=pie -trimpath -mod=readonly -modcacherw";
GOLDFLAGS = "-s -w -X cmd.version=${version}";