Skip to content

Commit

Permalink
refactor(fixer_test.go): update line numbers in tests to reflect chan…
Browse files Browse the repository at this point in the history
…ges in lookup.go

feat(go.mod): update module path to reflect new repository name
refactor(lookup.go): remove unused functions and simplify the file structure for clarity
docs(lookup.go): add build ignore tag to exclude from regular build process
  • Loading branch information
yyoshiki41 committed May 5, 2024
1 parent d71de91 commit 8bfac54
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 28 deletions.
6 changes: 3 additions & 3 deletions fixer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ func TestLookup(t *testing.T) {
start, end int
err error
}{
{"testdata/lookup.go", "Reachable", 14, 16, nil},
{"testdata/lookup.go", "myString.String", 33, 35, nil},
{"testdata/lookup.go", "myString.Unreachable", 41, 43, nil},
{"testdata/lookup.go", "Reachable", 7, 9, nil},
{"testdata/lookup.go", "myString.String", 15, 17, nil},
{"testdata/lookup.go", "myString.Unreachable", 19, 21, nil},
{"testdata/lookup.go", "NotFound", 0, 0, ErrFuncNotFound},
}

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/yyoshiki41/rm-deadcode
module github.com/yyoshiki41/rdeadcode

go 1.22.2

Expand Down
26 changes: 2 additions & 24 deletions testdata/lookup.go
Original file line number Diff line number Diff line change
@@ -1,43 +1,21 @@
//go:build ignore

package main

import "fmt"

func main() {
Reachable()
}

func init() {
s := myString{Value: "hello"}
s.Reachable()
}

func Reachable() {
fmt.Println("reachable")
}

func Unreachable() {
fmt.Println("unreachable")
}

func ReachableByTest() {
fmt.Println("reachableByTest")
}

var _ fmt.Stringer = myString{}

type myString struct {
Value string
}

// NOTE: This function is unreachable but it is neccessary to implement the fmt.Stringer interface
func (s myString) String() string {
return s.Value
}

func (s myString) Reachable() {
return
}

func (s *myString) Unreachable() {
return
}

0 comments on commit 8bfac54

Please sign in to comment.