Fix linter and umask setting

This commit is contained in:
Joona Hoikkala 2026-02-03 23:59:39 +02:00
parent 0d1ca5cad7
commit f448431675
4 changed files with 18 additions and 3 deletions

View File

@ -4,7 +4,6 @@ import (
"flag" "flag"
"fmt" "fmt"
"os" "os"
"syscall"
"github.com/joohoi/acme-dns/pkg/acmedns" "github.com/joohoi/acme-dns/pkg/acmedns"
"github.com/joohoi/acme-dns/pkg/api" "github.com/joohoi/acme-dns/pkg/api"
@ -15,7 +14,7 @@ import (
) )
func main() { func main() {
syscall.Umask(0077) setUmask()
configPtr := flag.String("c", "/etc/acme-dns/config.cfg", "config file location") configPtr := flag.String("c", "/etc/acme-dns/config.cfg", "config file location")
flag.Parse() flag.Parse()
// Read global config // Read global config

View File

@ -250,7 +250,7 @@ func TestAuthoritative(t *testing.T) {
func TestResolveTXT(t *testing.T) { func TestResolveTXT(t *testing.T) {
iServer, db, _ := setupDNS() iServer, db, _ := setupDNS()
server := iServer.(*Nameserver) server := iServer.(*Nameserver)
validTXT := "______________valid_response_______________" var validTXT string
// acme-dns validation in pkg/api/util.go:validTXT expects exactly 43 chars for what looks like a token // acme-dns validation in pkg/api/util.go:validTXT expects exactly 43 chars for what looks like a token
// while our handler is more relaxed, the DB update in api_test might have influenced my thought // while our handler is more relaxed, the DB update in api_test might have influenced my thought
// Let's check why the test failed. Ah, "Received error from the server [REFUSED]"? No, "NXDOMAIN"? // Let's check why the test failed. Ah, "Received error from the server [REFUSED]"? No, "NXDOMAIN"?

9
umask_unix.go Normal file
View File

@ -0,0 +1,9 @@
//go:build !windows
package main
import "syscall"
func setUmask() {
syscall.Umask(0077)
}

7
umask_windows.go Normal file
View File

@ -0,0 +1,7 @@
//go:build windows
package main
func setUmask() {
// umask is not supported on Windows
}