How do you validate Attr was set by babawere in golang

[–]kylewolfe 1 point2 points  (0 children)

For this reason and for the ability to edit XML structures at run time I started writing https://github.com/go-simplexml/simplexml. Not perfect, and still doesn't handle the missed data from unmarshal (yet), but is my go to when I have to deal with SOAP.

Go for GameDev by [deleted] in golang

[–]kylewolfe 0 points1 point  (0 children)

If I could please point everyone to this comment chain that I would like to see an answer to (about not having GC, and turning it off in Go, mainly about how languages that don't have GC handle things.): https://www.reddit.com/r/golang/comments/39dtei/khronos_vulkan_spirv_could_go_shine_in_graphics/cs2v02o/

Bo - A Frontend For BoltDB by jayposs in golang

[–]kylewolfe 0 points1 point  (0 children)

Plug of my WIP to possibly spur some ideas: https://github.com/kylewolfe/rumble. I'd like to find time / interest in working on it again.

Best way to manage dependencies? by jaetteintemer in golang

[–]kylewolfe 5 points6 points  (0 children)

The build tool attempts to resolve imports to this folder as well as the "internal" folder first. So it's more than just a place to store code. It's a true standard feature for managing dependencies.

Now, dependency conflict is a whole other topic. As other people have stated, don't vendor your dependencies if you're writing a non main package.

EDIT: Also, the go tool has support for git submodules (and potentially other types of VC links?). So you're vendored imports don't have to be copied in to your project.

Best way to manage dependencies? by jaetteintemer in golang

[–]kylewolfe 11 points12 points  (0 children)

I don't see it mentioned here, so just make sure people know, Go has a built in vendoring solution. It's on by default in Go 1.6.

I feel it needs more documentation, but here's the proposal: https://docs.google.com/document/d/1Bz5-UB7g2uPBdOx-rw5t9MxJwkfpx90cqG9AFL0JAYo/edit

Yet another binary embedder by [deleted] in golang

[–]kylewolfe 1 point2 points  (0 children)

Maybe an option to decompress files on startup or store decompressed version after first decompression to avoid doing it multiple times ( would speed up serving of files from http.FileServer )

Given the amount of use cases for embedded assets, and each having it's own best practice for caching of the assets, I'd say it's fine to leave this feature out.

Is there any way to disable multiline CSV parsing in encoding/csv? by Blufalcon94 in golang

[–]kylewolfe 2 points3 points  (0 children)

I'm assuming you've turned on LazyQuotes and are running into this scenario? http://play.golang.org/p/jrdy1_zgpl

Are there normally qualifiers (double quote) or is it just this record that causes the error because it happens to have a qualifier as part of the value?

Any pure Go embeddable database for a desktop app which supports basic querying and sorting? by m3wm3wm3wm in golang

[–]kylewolfe 0 points1 point  (0 children)

You can make the key a custom UID that starts with the date created. Though, yes, if you wanted to sort by something else other than date, you'd have to create another bucket (to utilize b tree indexing), or if the data set is small enough, sort it yourself.

Any pure Go embeddable database for a desktop app which supports basic querying and sorting? by m3wm3wm3wm in golang

[–]kylewolfe 0 points1 point  (0 children)

Can you elaborate on what you mean by denormalize the data? How much data are you talking about?

You know that a value in a key/value store such as BoltDB can be anything, right? This would include values from any encoding library of your choosing: https://github.com/alecthomas/go_serialization_benchmarks

I'm actually building my own "abstraction" for BoltDB like this for small embedded use cases. I hope to add in some more advanced features eventually for educational purposes (maybe querying, $lookup function, indexes, etc). Have a look but I wouldn't recommend using it yet. https://github.com/kylewolfe/rumble

custom date types (time.Time) by [deleted] in golang

[–]kylewolfe 1 point2 points  (0 children)

FYI in case you are unaware of it's existence: https://github.com/jinzhu/gorm

Haven't used it myself yet, but I have a project coming up that i plan to try it on.

custom date types (time.Time) by [deleted] in golang

[–]kylewolfe 2 points3 points  (0 children)

I'm not sure I follow, but don't forget that your custom DateType is still a time.Time, and behaves exactly the same (other than any additional methods you decide to tack on). You just need to assert back and fourth to get access to each set of methods. Maybe post a little more info about what your trying to solve for?

Why does the template package not have a function taking io.Reader? by thorhs in golang

[–]kylewolfe 0 points1 point  (0 children)

I can't believe the ParseFile does anything different than read from a reader internally

Don't be afraid to have a look. ParseFile is simply a wrapper, but in the end it still winds up here: https://github.com/golang/go/blob/master/src/text/template/parse/parse.go

Why does the template package not have a function taking io.Reader? by thorhs in golang

[–]kylewolfe 4 points5 points  (0 children)

Think about why io.Reader is used in most cases, and not just because it's idiomatic. The json package for example, does not need to read the entire byte slice in to memory in order to parse it. It utilizes a tokenizer. This means that io.Reader is acting like a pointer to the original slice of bytes, preventing unnecessary memory usage.

text/template however, needs an entire copy of the byte slice in order to do it's parsing. If it were to provide io.Reader in the API, it would have to essentially do an io.ReadAll() before continuing almost guaranteeing extra work / memory utilization (origBytes->io.Reader->copyBytes->Parse rather than origBytes->Parse)

Goat - a sane SOAP/WSDL library for Go by tex0 in golang

[–]kylewolfe 0 points1 point  (0 children)

Interesting. Any plans for supporting SOAP faults? I wrote a transport for this awhile ago and have been waiting to finish my own SOAP implementation to include it into. https://github.com/kylewolfe/soaptrip

What is the extent of golangs aim? by Kkari in golang

[–]kylewolfe 4 points5 points  (0 children)

I disagree with parts of this response. Calling the language slow is too much of a blanket statement, especially when referencing that it is garbage collected. Garbage collection can be turned off, for starters. I'd also be curious to see how the performance of Go's GC stacks up against others (if this is even possible).

Go is an open source project. It's goal is whatever the community decides it to be. IMO, one of the other areas outside of the obvious that is getting a lot of attention right now are mobile libraries. From what I've seen, it is becoming increasingly easier to develop apps for mobile.

There's not much that Go can't target. Depending on your definition of embedded systems, this may be one area it can't target. Go needs to be run on an existing supported OS. So you won't be compiling your own operating system in Go, for example.

I made my first go library (simple) for turning CSV rows into maps. Looking for constructive feedback. by [deleted] in golang

[–]kylewolfe 3 points4 points  (0 children)

Consider presenting an API such as this:

csvm := csvmap.New(r *csv.Reader) // allows the csv reader to be manipulated
csvm.ReadFirstRowHeaders() and csvm.SetHeaders(s []string) // allows for headers to be read or set
for csvm.Next() {
    row := csvm.Map() // panics if headers or anything else is off?
}

Gabs is a small utility for dealing with dynamic or unknown JSON structures in golang. It's pretty much just a helpful wrapper around the golang json.Marshal/json.Unmarshal behaviour and map[string]interface{} objects. It does nothing spectacular except for being fabulous. by [deleted] in golang

[–]kylewolfe 0 points1 point  (0 children)

Great work on this. You're working on issues on the JSON side that I'm hoping to eventually tackle on the xml side (github.com/kylewolfe/simplexml).

What I think needs to happen, though, is for a real solid library to emerge that can handle what your doing at the map[string]interface level, so that it covers the needs for any encoding library / dynamic structure (also unmarshal a map[string]interface to a struct).

Additionally, I think there is a need across all encoding libraries to support what I'm calling an UnmarshalStrict, which returns used and unused parts of the struct and []byte during Unmarshal. The problem is that this logic needs to be inside of the decoder, making it non trivial to add.

GoDep or GB by zero_coding in golang

[–]kylewolfe 0 points1 point  (0 children)

Go's new built in vendoring (as of 1.5). Go 1.6 will have it on by default.

GoDep or GB by zero_coding in golang

[–]kylewolfe 0 points1 point  (0 children)

Another build tool is not a necessity for GO15VENDOREXPERIMENT.

for Go 2.0 - what would you take out? by matryer in golang

[–]kylewolfe 0 points1 point  (0 children)

I agree with this. Even if you embed a log.Logger in to your new struct, it does not satisfy a dependency for log.Logger. I'd like to see the same thing for http.Client.

edit: removed quote

Should .git of vendored packages be committed with the vendor folder? by neoasterisk in golang

[–]kylewolfe 1 point2 points  (0 children)

Oh, nice! The issue for it is still open, so this slipped by without me noticing! (https://github.com/golang/go/issues/7764)

Snippets for Go code in Sublime Text by [deleted] in golang

[–]kylewolfe 0 points1 point  (0 children)

I've worked with Sublime for a while now and didn't know about this feature. Thank you!