How not to use context.WithValue in Go

2 ยท Vishnu Bharathi ยท March 6, 2023, 1:30 a.m.
While working on my recent Go project, I had a use-case where I wanted to pass a struct between two Go packages and I used context.WithValue to do it.In retrospect while reading the Go docs for it, I believe I have gone against every possible rule for using it ๐Ÿ˜… Sometimes you will have to try things out practically to get a lasting lesson.This is such a case and I am going to share the lessons that I learned here.All these lessons come from this single commit - feel free to take a look at it if ...