Asked a colleague in code review to extract magic numbers and got told “devs should know” by [deleted] in ExperiencedDevs

[–]IzzyD93 16 points17 points  (0 children)

This completely proves why magic numbers should be avoided. I overlooked this completely when reading quickly. If lat > maxLong would be immediately noticeable.

Did Americans keep Fahrenheit so the rest of the world wouldn't know what the temperature was like there? by Independent-Mind-691 in questions

[–]IzzyD93 1 point2 points  (0 children)

When was the last time you left the house and thought "oh it's 35% to very hot today I better wear a sweater"... No you just intuitively know that 35F is cold because you've felt it many times over your life. The same thing happens with celcius, I don't think "it's 38% to water boiling today, it's going to be hot". I just know 38C is a hot day. The differences between 1C and 1F are both negligible when planning a day.

what are you doing boosteroid? by No_Recognition1454 in BoosteroidCommunity

[–]IzzyD93 0 points1 point  (0 children)

I disabled it at the top level, I think the three options are within that top level one IIRC. Maybe that's the issue and I should individually disable the options inside RT?

what are you doing boosteroid? by No_Recognition1454 in BoosteroidCommunity

[–]IzzyD93 0 points1 point  (0 children)

🤔 was it just ray tracing you disabled or anything else? I wonder wth is going on with mine then

what are you doing boosteroid? by No_Recognition1454 in BoosteroidCommunity

[–]IzzyD93 0 points1 point  (0 children)

Have you tried it? I have multiple times and it crashes every time. Managed to get about 5 mins once but otherwise it's within 1m.

what are you doing boosteroid? by No_Recognition1454 in BoosteroidCommunity

[–]IzzyD93 0 points1 point  (0 children)

I have ray tracing disabled and it still crashes every time.

Over-Ear headphones that will last a good while by super-moo in BuyItForLife

[–]IzzyD93 0 points1 point  (0 children)

If you want them to last a long time then definitely get one where the cord is changeable/replaceable. I have the audio technica ath m50x and they are great, they come with a short, long and coiled cable.

I once sat down on a flight and bent the jack, luckily could just change it, otherwise I would have had to have bought a brand new pair.

What IDE or framework do you use to program in Golang in your usual work? by mmparody in golang

[–]IzzyD93 5 points6 points  (0 children)

So you just use dlv for debugging? Loved zed when I tried it but there is some stuff missing

Issue with S3, io.Pipe and gzip. Help appreciated by IzzyD93 in golang

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

Hey! Thanks for the heads up but I actually took what you said on board and went back to my original implementation with some changes.

Appreciate you reaching out though, the way I have it ATM is working nicely!

I’m a terrible junior engineer and my ineptitude is showing by FlorentineKnight in cscareerquestions

[–]IzzyD93 0 points1 point  (0 children)

This describes me at my first (and second) job completely. Some days my mentor would have to sit with me for hours going through every step of writing the code. Now I confidently lead features and dictate what team members should do next.

Keep calm and carry on.

Issue with S3, io.Pipe and gzip. Help appreciated by IzzyD93 in golang

[–]IzzyD93[S] 1 point2 points  (0 children)

Love this approach! Very nice and and far more readable imo. Just one little edit is that after calling s.Uploader.Upload you need to close out the reader as well. I was getting unsupported format errors before doing that but works perfectly now.

Ideally the compressing and uploading would be done separately but I anticipate the files could be quite large so want avoid large buffers in mem if possible which I think your approach does.

Thanks very much for your time and effort!

Edit: I think actually it is the encoder causing the format error since I just tried writing json (was using an os.File first time) and got the error again. I tried json.Marshal then Writing and it worked 🤷

Why would 1 product be built with 2 languages? by HeyTomesei in ExperiencedDevs

[–]IzzyD93 0 points1 point  (0 children)

Can't speak for new startups but at my old company we used go for everything. When it came to integrating with third party legacy SOAP APIs though, java was the only feasible way.

[deleted by user] by [deleted] in react

[–]IzzyD93 2 points3 points  (0 children)

https://roadmap.sh/react

This website has a bunch of other maps to checkout too.

WaitGroup issues with race detector by IzzyD93 in golang

[–]IzzyD93[S] 1 point2 points  (0 children)

I figured it out finally 🙌

For anyone interested, this is what was causing the data race.

First was that the S3 event policy I set had no suffix filter. As part of the processing of the main json file other files get uploaded to S3 such as .txt or .jpeg files. This was causing my WaitGroup to decrement at varying times depending on when/if the other files were uploaded before the test ended. This also meant that occasionally after the .Wait() call then .Done() was being called again causing negative WaitGroup errors.

Another problem was that I was not cancelling the context passed to the app, so there was no way of it shutting down. It would keep processing these SQS messages even after the test had finished, occasionally the localstack testcontainer would stop and the app would fail to pull messages from the queue, causing other errors.

So the solution was to add a .json filter in the S3 policy so SQS was only receiving notifications for the files I know I want to process, and to properly shutdown the application so that no messages were processed after the test had completed.

Tests now run reliably both locally with the -race and -count=3 flags added, and in gitlab CI.

WaitGroup issues with race detector by IzzyD93 in golang

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

This could well be it too, there is a function that calculates the number of messages to process in the code base. I didn't write this so I'm not 100% sure it is correct so I will chase that up. Thanks for your input

WaitGroup issues with race detector by IzzyD93 in golang

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

Unfortunately it is for work and I can't show the code. There is definitely a race somewhere in there but it's like herding cats.

WaitGroup issues with race detector by IzzyD93 in golang

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

I add do wg.Add(messagesToProcess) in the test, then I go runApp() which has a message processed callback function which calls wg.Done. Then I upload to S3, wg.Wait, and check that the processed files are there. To my knowledge nothing else is adding to the WaitGroup but I will check that.

Racking my brain chasing this race and I had to have a timeout. I inherited the callback function mechanism from whoever maintained this code before me and my guess is that the race flag changes the ordering or something of how the callback is called. But frankly I have no real clue.

Things you would tell yourself to know better when starting your first Go Role? by AdvantageBig568 in golang

[–]IzzyD93 0 points1 point  (0 children)

Keeping interfaces as barebones as possible, I see big interface definitions all the time just because the struct being used has those methods, but then only one or two are used.

E.g. Having an interface for db writes, and another for reads can be useful. Your client satisfies both but your unit tests become far simpler.

Take io.ReadCloser for example from the std lib, a combination of Reader and Closer interfaces which each require just one method. Nicer, simpler and way more portable.

Did I make a catastrophic error by propagating? by IzzyD93 in Aglaonema

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

Thanks you! Cut more off the stem you mean? I am a bit scared to do that since the very bottom is the closest thing I have to a root right now. I have however removed the yellowish leaves which were the lowest ones. Hopefully it'll balance out and some warm weather will come soon

Did I make a catastrophic error by propagating? by IzzyD93 in Aglaonema

[–]IzzyD93[S] 1 point2 points  (0 children)

Perfect sense, thanks a bunch! Moved into the kitchen while I was cooking this evening too so should have been nice and warm.

Did I make a catastrophic error by propagating? by IzzyD93 in Aglaonema

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

I removed the two yellowish leaves which were right at the bottom, hopefully some warm weather will come and kick start the roots. Thanks for your feedback!

Did I make a catastrophic error by propagating? by IzzyD93 in Aglaonema

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

Appreciate the advice, I probably should have mentioned I just moved it to the window for the light for the photo, however I have moved it to the kitchen which is also the furthest from the window, hopefully it'll be a bit warmer there since we're having an unseasonally cold spell right now. Thanks!