From c026eab1557fe253e8210946bca1695a3c9ae8c1 Mon Sep 17 00:00:00 2001 From: ibnaleem Date: Sun, 24 Nov 2024 05:46:14 +0000 Subject: [PATCH] add comment that explains why gosearch uses repo config.yaml and not local config.yaml --- gosearch.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/gosearch.go b/gosearch.go index 40bdb89..b00e3ad 100644 --- a/gosearch.go +++ b/gosearch.go @@ -50,6 +50,14 @@ type Cookie struct { } func UnmarshalYAML() (Config, error) { + + // GoSearch relies on config.yaml to determine the websites to search for. + // Instead of forcing uers to manually download the config.yaml file, we will fetch the latest version from the repository. + // Thereforeore, we will do the following: + // 1. Delete the existing config.yaml file if it exists as it will be outdated in the future + // 2. Read the latest config.yaml file from the repository + // Bonus: it does not download the config.yaml file, it just reads it from the repository. + err := os.Remove("config.yaml") if err != nil && !os.IsNotExist(err) { return Config{}, fmt.Errorf("error deleting old config.yaml: %w", err)