Giter VIP home page Giter VIP logo

Comments (4)

julianfrank avatar julianfrank commented on August 15, 2024 1

I stopped working on windows and now use Ubuntu... same code works without any problem in ubuntu!

from gotests.

kaskavalci avatar kaskavalci commented on August 15, 2024 1

For me it was the commented out import statement in test file. Removing it fixed the problem.

import (
	// . "github.com/smartystreets/goconvey/convey"
)

from gotests.

cweill avatar cweill commented on August 15, 2024

Any updates on this issue?

from gotests.

Xjs avatar Xjs commented on August 15, 2024

This issue is still happening. I think I have found the cause:

On Windows, lines usually end with \r\n (CR, LF) unlike Unix's \n (LF).

In goparser.go:165, the start point of the code is set to furthestPos + 1, where furthestPos is the End() of the last ast.ImportSpec in f.Imports. The documentation says »position of first character immediately after the node«, which on Unix will be the subsequent \n, but may be a \r on Windows.

So in a Unix-encoded file, b[furthestPos + 1] would be the closing brace after the imports block, as expected, but in a Windows-encoded file, b[furthestPos + 1] will be the \n after the \r after the last import spec, and so the closing brace will be included in the returned slice.

The solution that seems most viable for me is checking for a CR-LF combination at b[furthestPos+1] and if one is encountered, increasing the counter once more. (Since files may have mixed encodings as well, and files on Windows can also be LF-encoded, especially if they are copied from Unix contexts, I wouldn't use any other heuristic.) I will send a pull request in a minute.

from gotests.

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.