Git Product home page Git Product logo

Comments (7)

QuLogic avatar QuLogic commented on May 26, 2024 1

Sorry, I should have mentioned those details earlier. I am using:

$ go version
go version go1.19.6 linux/amd64

But I am not just running refactoring though, so other items fail as well. Besides the compile failures, there is also engine/cli:

ok  	github.com/godoctor/godoctor/engine	(cached)
--- FAIL: TestRenameDiff (0.09s)
    cli_test.go:206: Rename expected exit code 0; got 3
--- FAIL: TestRenameComplete (0.17s)
    cli_test.go:217: Rename expected exit code 0; got 3
--- FAIL: TestOneRefactoringOneParam (0.05s)
    cli_test.go:348: One refactoring with one arg, no input expected exit 0
FAIL
FAIL	github.com/godoctor/godoctor/engine/cli	0.456s

And for refactoring I get something like:

Extract Function testdata/extractfunc/005-param-passing-and-return/main.go
>>>>> Output does not match /home/elliott/code/go/godoctor/refactoring/testdata/extractfunc/005-param-passing-and-return/main.golden
EXPECTED OUTPUT
vvvvvvvvvvvvvvv
//<<<<<extract,10,2,14,15,Foo,pass
package main

import "fmt"

func main() {
	a := 3 + 0
	b := a
	c := 1 + 0
	a, x := Foo(a, b)
	z := a + x + c
	fmt.Println(z)
}

func Foo(a int, b int) (int, int) {
	for a <= b {
		a += b
	}
	x := a + b
	fmt.Println(x)
	return a, x
}
^^^^^^^^^^^^^^^
ACTUAL OUTPUT
vvvvvvvvvvvvv
// <<<<<extract,10,2,14,15,Foo,pass
package main

import "fmt"

func main() {
	a := 3 + 0
	b := a
	c := 1 + 0
	a, x := Foo(a, b)
	z := a + x + c
	fmt.Println(z)
}

func Foo(a int, b int) (int, int) {
	for a <= b {
		a += b
	}
	x := a + b
	fmt.Println(x)
	return a, x
}
^^^^^^^^^^^^^
Length of expected output is 268; length of actual output is 269
Strings differ at index 2
Substrings starting at that index are:
Expected: [<<<<<extra]
Actual: [ <<<<<extr]

for many tests. But there's also a small space change in, e.g.,:

Add GoDoc testdata/godoc/014-consistent-comment-style/main.go
>>>>> Output does not match /home/elliott/code/go/godoctor/refactoring/testdata/godoc/014-consistent-comment-style/main.golden
EXPECTED OUTPUT
vvvvvvvvvvvvvvv
package main // <<<<< godoc,1,1,1,1,pass

type (
	// A is a type
	A int
	// B TODO: NEEDS COMMENT INFO
	B int
	c string
)

const (
	// StatusOk TODO: NEEDS COMMENT INFO
	StatusOk = 1
	// StatusBad is bad
	StatusBad = 2
)

//  TODO: NEEDS COMMENT INFO
var (
	Foo = "Foo"
	Bar = "Bar"
)

func main() {
}
^^^^^^^^^^^^^^^
ACTUAL OUTPUT
vvvvvvvvvvvvv
package main // <<<<< godoc,1,1,1,1,pass

type (
	// A is a type
	A int
	// B TODO: NEEDS COMMENT INFO
	B int
	c string
)

const (
	// StatusOk TODO: NEEDS COMMENT INFO
	StatusOk = 1
	// StatusBad is bad
	StatusBad = 2
)

// TODO: NEEDS COMMENT INFO
var (
	Foo = "Foo"
	Bar = "Bar"
)

func main() {
}
^^^^^^^^^^^^^
Length of expected output is 302; length of actual output is 301
Strings differ at index 225
Substrings starting at that index are:
Expected: [ TODO: NEE]
Actual: [TODO: NEED]

from godoctor.

QuLogic avatar QuLogic commented on May 26, 2024 1

New test failures with Go 1.21rc3:

Debug Refactoring testdata/debug/showast/main.go
>>>>> Debug output does not match contents of testdata/debug/showast/main.go.debugOutput
>>>>> NOTE: All occurrences of the working directory name are replaced by "."
EXPECTED OUTPUT
vvvvvvvvvvvvvvv
     0  *ast.File {
     1  .  Doc: nil
     2  .  Package: ./testdata/debug/showast/main.go:1:1
     3  .  Name: *ast.Ident {
     4  .  .  NamePos: ./testdata/debug/showast/main.go:1:9
     5  .  .  Name: "main"
     6  .  .  Obj: nil
     7  .  }
     8  .  Decls: nil
     9  .  FileStart: ./testdata/debug/showast/main.go:1:1
    10  .  FileEnd: ./testdata/debug/showast/main.go:1:48
    11  .  Scope: *ast.Scope {
    12  .  .  Outer: nil
    13  .  .  Objects: map[string]*ast.Object (len = 0) {}
    14  .  }
    15  .  Imports: nil
    16  .  Unresolved: nil
    17  .  Comments: []*ast.CommentGroup (len = 1) {
    18  .  .  0: *ast.CommentGroup {
    19  .  .  .  List: []*ast.Comment (len = 1) {
    20  .  .  .  .  0: *ast.Comment {
    21  .  .  .  .  .  Slash: ./testdata/debug/showast/main.go:1:14
    22  .  .  .  .  .  Text: "//<<<<<debug,1,1,1,1,showast,pass"
    23  .  .  .  .  }
    24  .  .  .  }
    25  .  .  }
    26  .  }
    27  }
^^^^^^^^^^^^^^^
ACTUAL OUTPUT
vvvvvvvvvvvvv
     0  *ast.File {
     1  .  Doc: nil
     2  .  Package: ./testdata/debug/showast/main.go:1:1
     3  .  Name: *ast.Ident {
     4  .  .  NamePos: ./testdata/debug/showast/main.go:1:9
     5  .  .  Name: "main"
     6  .  .  Obj: nil
     7  .  }
     8  .  Decls: nil
     9  .  FileStart: ./testdata/debug/showast/main.go:1:1
    10  .  FileEnd: ./testdata/debug/showast/main.go:1:48
    11  .  Scope: *ast.Scope {
    12  .  .  Outer: nil
    13  .  .  Objects: map[string]*ast.Object (len = 0) {}
    14  .  }
    15  .  Imports: nil
    16  .  Unresolved: nil
    17  .  Comments: []*ast.CommentGroup (len = 1) {
    18  .  .  0: *ast.CommentGroup {
    19  .  .  .  List: []*ast.Comment (len = 1) {
    20  .  .  .  .  0: *ast.Comment {
    21  .  .  .  .  .  Slash: ./testdata/debug/showast/main.go:1:14
    22  .  .  .  .  .  Text: "//<<<<<debug,1,1,1,1,showast,pass"
    23  .  .  .  .  }
    24  .  .  .  }
    25  .  .  }
    26  .  }
    27  .  GoVersion: ""
    28  }
^^^^^^^^^^^^^
Length of expected output is 959; length of actual output is 984
Strings differ at index 957
Substrings starting at that index are:
Expected: [}\n]
Actual: [.  GoVersi]

It appears that ast.File now has a GoVersion member.

from godoctor.

rdallman avatar rdallman commented on May 26, 2024

uh oh. thanks for running the tests. I ran them to make sure on my machine, and with go 1.18 they do still work for me when running go test from the refactoring/ directory. I will try to update go and reproduce though. can you provide any more info possibly? macos/linux? go version?

from godoctor.

QuLogic avatar QuLogic commented on May 26, 2024

I attempted to fix the compile in #61 (but not the other issues).

from godoctor.

rdallman avatar rdallman commented on May 26, 2024

got a repro. updating go to 1.20 has cropped up numerous errors, as posted. thanks for the info! I'll try to whittle away the rest of the tests.

from godoctor.

rdallman avatar rdallman commented on May 26, 2024

gonna leave this open for now even though it is scary :) hope to fix the cgo and cli test issues too, but things are in a decent state now from #63

from godoctor.

rdallman avatar rdallman commented on May 26, 2024

thanks @QuLogic for catching this - I'm going to wait until release of 1.21 and try to add build constraints to make this somewhat obvious.

from godoctor.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.