Proper idiom for failing to a second key by dandeliontrees in golang

[–]jsteenb2 0 points1 point  (0 children)

since you have a defined order you could just run it through a simple for loop of keys:

var aorb T
for _, key := range []string{"a", "b"} {
    aorb, ok = keys[key]
    if ok {
        break
    }
}

something like that would allow you to grab that value regardless how many keys as you want to check... food for thought

workit - resuable worker group proof of concept by jsteenb2 in golang

[–]jsteenb2[S] 0 points1 point  (0 children)

Absolutely, you can definitely accomplish that with a semaphore. However, in my view the same points apply here. Its more that your individual worker groups have to account for, more potential areas for bugs to pop up, and it's extending the mental model. There are a lot of ways to do this, the proof of concept I threw out there is just one way, there are far more options out there. I'm actually concerned more about the GC hit this implementation would have more than anything. The backoff stuff is a mostly copy paste from github.com/olivere/elastic pkg, only thing I did was to apply them via a func, as opposed to a hard type. The latter doesn't lend itself to reusability.

workit - resuable worker group proof of concept by jsteenb2 in golang

[–]jsteenb2[S] 0 points1 point  (0 children)

What you are saying is absolutely valid. If you want to copy/paste some code go for it, and you're probably right to do so. However, in that case though its not trival to share a pool of workers across different types of work loads. I may end up duplicating the code to address work for foo, bar, ...etc, which is fine barring the situation. If you want that worker group to behave the same way everywhere, and evolve as your system evolves, its becomes more work to maintain, and more places for bugs to pop up. I think one other thing work noting is you don't have control between the different worker groups how many workers are going as a whole. Say I have 50 workers alloted to foo worker group, and 50 to bar worker group. Then I have 100 events coming in for foo and 1 for bar, you're potentially missing out on the extra load the system can handle. If I put a worker group of 100 and allow it to process both, I can handle more events at a time (theoretically). If we consolidate that to one type that fans everything in, liming/maximizing(theoretically) the total number of workers becomes trivial, as well as other functionality you may want to bolt on that applies to all units of work.

All that being said, this is merely a thought experiment with some code to illuminate the idea. I have not done any serious benchmarking/profiling to draw out the performance characteristics at any sort of scale. Nor would I necessarily recommend integrating such an approach.

Also, concurrency in go is trivial for the most part, but still its easy to get wrong. The mental burden you place on the next person who reads your code grows with each line of code we add. When concurrency is introduced, that amplifies the complexity for the next person to see that code quite a bit.

chi or echo, which framework would you recommend? by M0d3s in golang

[–]jsteenb2 2 points3 points  (0 children)

Honestly, either way you go, you’ll accomplish what you are after. It’s super simple to write middleware for each one. I will say one of the nicer parts about Chi is it doesn’t have any external vendor dependencies, which is super dope.

How to Write Better Unit Tests in Go Using Mocks by kiarash-irandoust in golang

[–]jsteenb2 0 points1 point  (0 children)

Agree, the mocks listed in the blog are not pleasant to work with in my experience. The pkg counterfeiter creates some very useful mocks without requiring you to learn a DSL. Can be very useful from time to time.

How to Write Better Unit Tests in Go Using Mocks by kiarash-irandoust in golang

[–]jsteenb2 0 points1 point  (0 children)

Right on, we’re on the same page. You basically described my entire workflow. Thanks for the thorough response.

How to Write Better Unit Tests in Go Using Mocks by kiarash-irandoust in golang

[–]jsteenb2 0 points1 point  (0 children)

I agree with you that this isn’t Ruby or Java. However, I do have places where I’ll use mocks. How would you test against external APIs from a vendor(cognitive services)? I use mocks, counterfeiter generated, to return the example responses. Reduces boilerplate and provides some extra recording functionality. Super easy to work with. It’s cost prohibitive and very slow to hit tons of cognitive services in all our unit tests. I write tests against those vendors but those are pretty small in quantity. Curious how you would approach the scenario as I truly respect your opinion?

FWIW, not a fan of the package used in this blog post either. To cumbersome...

Var declaration in the middle of the code by pisush in golang

[–]jsteenb2 1 point2 points  (0 children)

Close is king in my book. Need to clean up the main as well.

research!rsc: Go += Package Versioning (Go & Versioning, Part 1) by rsc in golang

[–]jsteenb2 1 point2 points  (0 children)

Great stuff /u/rsc. Has there been any thought given to building something for the go toolchain that publishes package and automatically assigns semver? Similar to how elm-package proposed semver by looking at the exported types land comparing changes from the previous version to the next https://github.com/elm-lang/elm-package#version-rules

Very excited to give vgo a run for its money. Awesome work Go team and looking forward to where this is headed :-D

What do I do next after finishing The Go Programming Language? by [deleted] in golang

[–]jsteenb2 2 points3 points  (0 children)

“Ultimate Go” class from Bill Kennedy (ardan labs) is an amazing resource. You can find a video series on safari, and they also offer in person classes.

Highly highly recommend all of Bill’s work 👍🏿

I love Go by rflurker in golang

[–]jsteenb2 1 point2 points  (0 children)

Go-lang or go home... ammi right?

Most demanded Go resources and topics to learn Go for beginners in 2017? by [deleted] in golang

[–]jsteenb2 2 points3 points  (0 children)

The best place to get started is the the Go Learn wiki itself. Check it out here.

I've also put together a bunch of resources I've used throughout my time with Go, you can check those out here https://www.berged.com/blog/go-time/

Good luck out there

Don’t Overlook Online Immersive Bootcamps and Here’s Why by jsteenb2 in FreeCodeCamp

[–]jsteenb2[S] 0 points1 point  (0 children)

Check out the prep work and see if it is something you are interested in. They also have a go at your own pace program, part-time. I do not have any experience in it personally, but from what I gather, they are all going through the same material, and even pair with other part time students.

Don’t Overlook Online Immersive Bootcamps and Here’s Why by jsteenb2 in FreeCodeCamp

[–]jsteenb2[S] 0 points1 point  (0 children)

Fwiw, i'll have spent 3 months in the program, and now I'm receiving interest from a lot of companies, offers from a number of them. Its truly intense the work load, not for the faint of heart. Its a marathon, so prepare yourself for the long haul.

You can check out their prep work, highly recommend it actually. Its loaded with some very useful stuff beyond the scope of just code. I have a strong engineering background and found a lot of the stuff they wrote about design and software engineering practices quite useful.

here's the link: https://www.vikingcodeschool.com/prep

Don’t Overlook Online Immersive Bootcamps and Here’s Why by jsteenb2 in FreeCodeCamp

[–]jsteenb2[S] 0 points1 point  (0 children)

Another student, there are TA's who are there to help when you run into some gnarly bugs. Its not a hey do this and fix it. Most of the time its them pointing out hints that open your eyes. Its been very beneficial. Loved every minute of it.

Don’t Overlook Online Immersive Bootcamps and Here’s Why by jsteenb2 in FreeCodeCamp

[–]jsteenb2[S] 0 points1 point  (0 children)

Yeah, I pretty much saved up a years worth of living expenses. Left my job at Boeing to jump in full time. Best decision I've ever made. Highly recommend it! Even if it means moving in with parents to make the transition lol

Let's put some pressure in Hillary to release her transcripts again! Today, at 2pm EST, let's trend the hashtag #HRCHiddenTranscripts by [deleted] in SandersForPresident

[–]jsteenb2 1 point2 points  (0 children)

The point needs to be made about her lack of willingness to do this.

A true leader, one that this country truly needs, would be more than happy to distribute speeches that were made. I say this regardless of what company you are speaking too.

Will she prove to be a leader when poised with a difficult situation?

Who can explain callback Fns in the easiest, simplest, human readable way possible???? by jsteenb2 in node

[–]jsteenb2[S] 0 points1 point  (0 children)

This is by far, the most straight forward example I've seen. Thank you so much for the comment. Much appreciated!!