From af7badfb7f8fa3078dc41825d96d4abab3196a86 Mon Sep 17 00:00:00 2001
From: Volker Schukai <volker.schukai@schukai.com>
Date: Sun, 10 Sep 2023 16:56:51 +0200
Subject: [PATCH] chore: licenses and build optimization

---
 Taskfile.yml                                  |  7 ++-
 devenv.nix                                    | 57 ++++++++++---------
 licenses/github.com/fsnotify/fsnotify/LICENSE | 25 ++++++++
 licenses/golang.org/x/sys/unix/LICENSE        | 27 +++++++++
 4 files changed, 85 insertions(+), 31 deletions(-)
 create mode 100644 licenses/github.com/fsnotify/fsnotify/LICENSE
 create mode 100644 licenses/golang.org/x/sys/unix/LICENSE

diff --git a/Taskfile.yml b/Taskfile.yml
index 055abcf..767ae21 100644
--- a/Taskfile.yml
+++ b/Taskfile.yml
@@ -5,8 +5,9 @@ version: '3'
 tasks:
   default:
     cmds:
-      - task --list-all
+      - task --list
     silent: true
+    
   test:
     desc: Execute unit tests in Go.
     cmds:  
@@ -21,11 +22,11 @@ tasks:
       - echo "Conduct fuzzing tests."
       - go test -v -fuzztime=30s -fuzz=Fuzz ./...
 
-  add-licenses:
+  update-licenses:
     desc: Attach license headers to Go files.
     cmds:
       - echo "Attach license headers to Go files."
-      - addlicense -c "schukai GmbH" -s -l "AGPL-3.0" ./*.go
+      - go-licenses save ./... --save_path=licenses --force --ignore=gitlab.schukai.com
     silent: true
 
   check:
diff --git a/devenv.nix b/devenv.nix
index 2568f0c..f7f2003 100644
--- a/devenv.nix
+++ b/devenv.nix
@@ -3,34 +3,35 @@
 {
 
   # https://devenv.sh/packages/
-  packages = [
+  packages = with pkgs; [
     inputs.version.defaultPackage."${builtins.currentSystem}"
-    pkgs.git
-    pkgs.gcc12
-    pkgs.go-task
-    pkgs.blackbox
-    pkgs.blackbox-terminal
-    pkgs.jq
-    pkgs.delve
-    pkgs.gdlv
-    pkgs.wget
-    pkgs.glab
-    pkgs.unixtools.xxd
-    pkgs.libffi
-    pkgs.zlib
-    pkgs.procps
-    pkgs.php81Extensions.xdebug
-    pkgs.ranger
-    pkgs.meld
-    pkgs.gnused
-    pkgs.coreutils-full
-    pkgs.gnugrep
-    pkgs.gnumake
-    pkgs.util-linux
-    pkgs.httpie
-    pkgs.netcat
-    pkgs.memcached
-    pkgs.fd    
+    git
+    gcc12
+    go-task
+    blackbox
+    blackbox-terminal
+    jq
+    delve
+    gdlv
+    wget
+    glab
+    unixtools.xxd
+    libffi
+    zlib
+    procps
+    php81Extensions.xdebug
+    ranger
+    meld
+    gnused
+    coreutils-full
+    gnugrep
+    gnumake
+    util-linux
+    httpie
+    netcat
+    memcached
+    fd    
+    go-licenses
   ];
 
 
@@ -65,7 +66,7 @@ PATH="''${PATH}":${pkgs.git}/bin/
 PATH="''${PATH}":${pkgs.gnugrep}/bin/
 PATH="''${PATH}":${inputs.version.defaultPackage."${builtins.currentSystem}"}/bin/
 
-export -f PATH
+export PATH
 
 task test
 
diff --git a/licenses/github.com/fsnotify/fsnotify/LICENSE b/licenses/github.com/fsnotify/fsnotify/LICENSE
new file mode 100644
index 0000000..fb03ade
--- /dev/null
+++ b/licenses/github.com/fsnotify/fsnotify/LICENSE
@@ -0,0 +1,25 @@
+Copyright © 2012 The Go Authors. All rights reserved.
+Copyright © fsnotify Authors. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this
+  list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright notice, this
+  list of conditions and the following disclaimer in the documentation and/or
+  other materials provided with the distribution.
+* Neither the name of Google Inc. nor the names of its contributors may be used
+  to endorse or promote products derived from this software without specific
+  prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/licenses/golang.org/x/sys/unix/LICENSE b/licenses/golang.org/x/sys/unix/LICENSE
new file mode 100644
index 0000000..6a66aea
--- /dev/null
+++ b/licenses/golang.org/x/sys/unix/LICENSE
@@ -0,0 +1,27 @@
+Copyright (c) 2009 The Go Authors. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+   * Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+   * Redistributions in binary form must reproduce the above
+copyright notice, this list of conditions and the following disclaimer
+in the documentation and/or other materials provided with the
+distribution.
+   * Neither the name of Google Inc. nor the names of its
+contributors may be used to endorse or promote products derived from
+this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-- 
GitLab