[PATCH] Add error when opening tags fails
Export this patch
Add a flake.nix to build on nixos systems
Also, fix logging for non-existant tags
add flake.lock
---
flake.lock | 25 +++++++++++++++++++++++++
flake.nix | 11 +++++++++++
hcwiki.go | 3 ++-
3 files changed, 38 insertions(+), 1 deletion(-)
create mode 100644 flake.lock
create mode 100644 flake.nix
diff --git a/flake.lock b/flake.lock
new file mode 100644
index 0000000..5b9a22f
--- /dev/null
+++ b/flake.lock
@@ -0,0 +1,25 @@
+{
+ "nodes": {
+ "nixpkgs": {
+ "locked": {
+ "lastModified": 1631750318,
+ "narHash": "sha256-Mk3kFkG4B2ydiaTdswr5awiVF9AKq5JzKoWIKCFTYZ8=",
+ "owner": "NixOS",
+ "repo": "nixpkgs",
+ "rev": "78230d1c42c8f0e870db6b9a8856c10c2826ee94",
+ "type": "github"
+ },
+ "original": {
+ "id": "nixpkgs",
+ "type": "indirect"
+ }
+ },
+ "root": {
+ "inputs": {
+ "nixpkgs": "nixpkgs"
+ }
+ }
+ },
+ "root": "root",
+ "version": 7
+}
diff --git a/flake.nix b/flake.nix
new file mode 100644
index 0000000..6e9d5ef
--- /dev/null
+++ b/flake.nix
@@ -0,0 +1,11 @@
+{
+ description = "A very basic flake";
+
+ outputs = { self, nixpkgs }: {
+
+ packages.x86_64-linux.hcwiki = (with nixpkgs.legacyPackages.x86_64-linux; callPackage ./default.nix {});
+
+ defaultPackage.x86_64-linux = self.packages.x86_64-linux.hcwiki;
+
+ };
+}
diff --git a/hcwiki.go b/hcwiki.go
index 86a18fd..0b44c1e 100644
--- a/hcwiki.go
+++ b/hcwiki.go
@@ -6,6 +6,7 @@ import (
"io/ioutil"
"net/url"
"os"
+ "log"
"os/exec"
"path"
"strings"
@@ -129,7 +130,7 @@ func loadTags(conf config) map[string]interface{} {
rawJSON, err := os.ReadFile(conf.TagFile)
if err != nil {
- panic(err)
+ log.Fatalf("Cannot open %v: %v", conf.TagFile, err)
}
json.Unmarshal(rawJSON, &tags)
--
2.33.0