OXIESEC PANEL
- Current Dir:
/
/
opt
/
golang
/
1.22.0
/
src
/
text
/
template
Server IP: 191.96.63.230
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
02/02/2024 06:09:55 PM
rwxr-xr-x
📄
doc.go
17.59 KB
02/02/2024 06:09:55 PM
rw-r--r--
📄
example_test.go
2.42 KB
02/02/2024 06:09:55 PM
rw-r--r--
📄
examplefiles_test.go
6.09 KB
02/02/2024 06:09:55 PM
rw-r--r--
📄
examplefunc_test.go
1.53 KB
02/02/2024 06:09:55 PM
rw-r--r--
📄
exec.go
31.84 KB
02/02/2024 06:09:55 PM
rw-r--r--
📄
exec_test.go
57.31 KB
02/02/2024 06:09:55 PM
rw-r--r--
📄
funcs.go
20.56 KB
02/02/2024 06:09:55 PM
rw-r--r--
📄
helper.go
6.26 KB
02/02/2024 06:09:55 PM
rw-r--r--
📄
link_test.go
1.22 KB
02/02/2024 06:09:55 PM
rw-r--r--
📄
multi_test.go
11.75 KB
02/02/2024 06:09:55 PM
rw-r--r--
📄
option.go
1.94 KB
02/02/2024 06:09:55 PM
rw-r--r--
📁
parse
-
02/02/2024 06:09:55 PM
rwxr-xr-x
📄
template.go
7.16 KB
02/02/2024 06:09:55 PM
rw-r--r--
📁
testdata
-
02/02/2024 06:09:55 PM
rwxr-xr-x
Editing: link_test.go
Close
// Copyright 2019 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package template_test import ( "bytes" "internal/testenv" "os" "os/exec" "path/filepath" "testing" ) // Issue 36021: verify that text/template doesn't prevent the linker from removing // unused methods. func TestLinkerGC(t *testing.T) { if testing.Short() { t.Skip("skipping in short mode") } testenv.MustHaveGoBuild(t) const prog = `package main import ( _ "text/template" ) type T struct{} func (t *T) Unused() { println("THIS SHOULD BE ELIMINATED") } func (t *T) Used() {} var sink *T func main() { var t T sink = &t t.Used() } ` td := t.TempDir() if err := os.WriteFile(filepath.Join(td, "x.go"), []byte(prog), 0644); err != nil { t.Fatal(err) } cmd := exec.Command(testenv.GoToolPath(t), "build", "-o", "x.exe", "x.go") cmd.Dir = td if out, err := cmd.CombinedOutput(); err != nil { t.Fatalf("go build: %v, %s", err, out) } slurp, err := os.ReadFile(filepath.Join(td, "x.exe")) if err != nil { t.Fatal(err) } if bytes.Contains(slurp, []byte("THIS SHOULD BE ELIMINATED")) { t.Error("binary contains code that should be deadcode eliminated") } }