File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,12 @@ func syscallSetenv(key, value string) {
1111 valdata := cstring (value )
1212 // ignore any errors
1313 libc_setenv (& keydata [0 ], & valdata [0 ], 1 )
14+ if key == "GODEBUG" && godebugUpdate != nil {
15+ // Starting with Go 1.20, we need to call a callback (set by
16+ // internal/godebug) to notify the GODEBUG environment variable has
17+ // changed. This is necessary to get archive/zip to pass tests.
18+ godebugUpdate (key , value )
19+ }
1420}
1521
1622// Update the C environment if cgo is loaded.
Original file line number Diff line number Diff line change @@ -96,8 +96,11 @@ func SetFinalizer(obj interface{}, finalizer interface{}) {
9696 // Unimplemented.
9797}
9898
99+ var godebugUpdate func (string , string )
100+
99101//go:linkname godebug_setUpdate internal/godebug.setUpdate
100102func godebug_setUpdate (update func (string , string )) {
101- // Unimplemented. The 'update' function needs to be called whenever the
102- // GODEBUG environment variable changes (for example, via os.Setenv).
103+ // The 'update' function needs to be called whenever the GODEBUG environment
104+ // variable changes (for example, via os.Setenv).
105+ godebugUpdate = update
103106}
You can’t perform that action at this time.
0 commit comments