Code Monkey home page Code Monkey logo

Comments (13)

piranha avatar piranha commented on August 25, 2024

Oh, I think that's because config splits on ----\n, and CRLF has ----\r\n instead. Maybe we should just split by regexp there? Like, ----\r?\n.

from gostatic.

krpors avatar krpors commented on August 25, 2024

Indeed, see source. I guess the safest version would be to use a Scanner to read line by line until the ---- has been found. See the example from the bufio package.

from gostatic.

piranha avatar piranha commented on August 25, 2024

I was also thinking - maybe try to split by \n----\n, and if it didn't work (there is only one part), then try to split by \r\n----\r\n.

Or even better! Choose splitter based on whenever there is \r contained in the file or not and if somebody mixes various line endings, that's their problems. :)

from gostatic.

krpors avatar krpors commented on August 25, 2024

Well that doesn't sound too user friendly... :P I'll check if I can whip something up with a reader or whatever. That way it doesn't really matter if you use \r\n, or \n, or \r or whatever the editor/user makes of it.

from gostatic.

LaBetonneuse avatar LaBetonneuse commented on August 25, 2024

Hi, I got the notice and I'll test that later (not sure when, though, I'm very busy at the moment).
I've read the comments and I'm pretty sure some systems use \r as the EOL marker so shouldn't we (i.e. you ;) ) cover all combinations (CRLF, CR and LF) ? What do you think?
Aren't there native Go functions that deal with that ?

from gostatic.

krpors avatar krpors commented on August 25, 2024

There was some merit in your comment. I remember MacOS used CR exlusively, but after some research, this only seem to apply to version prior MacOS X or whatever. Check out this list, and here.

AFAIK, gostatic (or any other Go program) doesn't compile on the other systems mentioned (Acorn BBC, QNX, RISC ...), so I suppose Windows CRLF and the Nix-es + Macs LF remain to support.

from gostatic.

LaBetonneuse avatar LaBetonneuse commented on August 25, 2024

At least we've learnt something in the process. ;)
I tried both 32 and 64 bit editions of the latest version and neither worked (both on Win8 x64).

from gostatic.

krpors avatar krpors commented on August 25, 2024

Did you use a binary that was built from source? If you didn't, that explains why neither worked :) The fix has been introduced in commit 311e9e5.

from gostatic.

LaBetonneuse avatar LaBetonneuse commented on August 25, 2024

I went to the download page without a second look. ^^
Is there a binary with the fix lying around?

from gostatic.

LaBetonneuse avatar LaBetonneuse commented on August 25, 2024

I downloaded the tools and the source code but I haven't used a Makefile in a while and I'm running Windows anyway. I don't have the time to figure out how to build it at the moment, is there a "how to build GoStatic on MS Windows(R) for dummies" doc, by any chance?

from gostatic.

piranha avatar piranha commented on August 25, 2024

Let's do it other way around: I'll just check a bit later myself and will do a new release if it works. :)

from gostatic.

piranha avatar piranha commented on August 25, 2024

Ok, I've checked and it works, so you can download 2.4, which will work. :)

from gostatic.

LaBetonneuse avatar LaBetonneuse commented on August 25, 2024

It does indeed. Thanks. :)

from gostatic.

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.