mirror of
https://github.com/coder/coder.git
synced 2025-07-13 21:36:50 +00:00
chore: Add nix shell for simple development setup (#3399)
* chore: Add nix shell for simple development setup This enables contributors using Nix to set up their environment with ease. * improve nix style, flake output schema * fix error message * Update scripts/build_go_slim.sh Co-authored-by: Mathias Fredriksson <mafredri@gmail.com> * Update scripts/build_go_slim.sh Co-authored-by: Mathias Fredriksson <mafredri@gmail.com> * Add UTC default for timezone and remove unnecessary goreleaser dependency * Skip TZ test if localtime does not exist Co-authored-by: Charlie Moog <moogcharlie@gmail.com> Co-authored-by: Mathias Fredriksson <mafredri@gmail.com>
This commit is contained in:
@ -33,7 +33,6 @@ func TimezoneIANA() (*time.Location, error) {
|
||||
if err != nil {
|
||||
return nil, xerrors.Errorf("read location of %s: %w", etcLocaltime, err)
|
||||
}
|
||||
|
||||
stripped := strings.Replace(lp, zoneInfoPath, "", -1)
|
||||
stripped = strings.TrimPrefix(stripped, string(filepath.Separator))
|
||||
loc, err = time.LoadLocation(stripped)
|
||||
|
@ -2,6 +2,7 @@ package tz_test
|
||||
|
||||
import (
|
||||
"os"
|
||||
"runtime"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
@ -25,6 +26,11 @@ func Test_TimezoneIANA(t *testing.T) {
|
||||
|
||||
//nolint:paralleltest // UnsetEnv
|
||||
t.Run("NoEnv", func(t *testing.T) {
|
||||
_, err := os.Stat("/etc/localtime")
|
||||
if runtime.GOOS == "linux" && err != nil {
|
||||
// Not all Linux operating systems are guaranteed to have localtime!
|
||||
t.Skip("localtime doesn't exist!")
|
||||
}
|
||||
oldEnv, found := os.LookupEnv("TZ")
|
||||
if found {
|
||||
require.NoError(t, os.Unsetenv("TZ"))
|
||||
|
Reference in New Issue
Block a user