-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
890 changed files
with
52,097 additions
and
31,917 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# Regression test for issue 65915: the enumeration of source-level | ||
# functions used the flawed ssautil.AllFunctions, causing it to | ||
# miss some unexported ones. | ||
|
||
deadcode -filter= example.com | ||
|
||
want "unreachable func: example.UnUsed" | ||
want "unreachable func: example.unUsed" | ||
want "unreachable func: PublicExample.UnUsed" | ||
want "unreachable func: PublicExample.unUsed" | ||
|
||
-- go.mod -- | ||
module example.com | ||
go 1.18 | ||
|
||
-- main.go -- | ||
package main | ||
|
||
type example struct{} | ||
|
||
func (e example) UnUsed() {} | ||
|
||
func (e example) Used() {} | ||
|
||
func (e example) unUsed() {} | ||
|
||
func (e example) used() {} | ||
|
||
type PublicExample struct{} | ||
|
||
func (p PublicExample) UnUsed() {} | ||
|
||
func (p PublicExample) Used() {} | ||
|
||
func (p PublicExample) unUsed() {} | ||
|
||
func (p PublicExample) used() {} | ||
|
||
func main() { | ||
example{}.Used() | ||
example{}.used() | ||
PublicExample{}.Used() | ||
PublicExample{}.used() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Test of -whylive with reflective call | ||
# (regression test for golang/go#67915). | ||
|
||
# The live function is reached via reflection: | ||
|
||
deadcode example.com | ||
want "unreachable func: dead" | ||
!want "unreachable func: live" | ||
|
||
# Reflective calls have Edge.Site=nil, which formerly led to a crash | ||
# when -whylive would compute its position. Now it has NoPos. | ||
|
||
deadcode -whylive=example.com.live example.com | ||
want " example.com.main" | ||
want " static@L0006 --> reflect.Value.Call" | ||
want "dynamic@L0000 --> example.com.live" | ||
|
||
-- go.mod -- | ||
module example.com | ||
go 1.18 | ||
|
||
-- main.go -- | ||
package main | ||
|
||
import "reflect" | ||
|
||
func main() { | ||
reflect.ValueOf(live).Call(nil) | ||
} | ||
|
||
func live() { | ||
println("hello") | ||
} | ||
|
||
func dead() { | ||
println("goodbye") | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.