#overlays

9 messages · Page 1 of 1 (latest)

simple perch
#

TL;DR:

go build -o .bin/example -overlay overlay.json -gcflags="all=-N -l" ./cmd/server/main.go

overlay.json (paraphrasing)

{
    "Replace": {
        "/.../path/to/file.go": "/.../local/file.go"
    }
}

I got the overlay to work, but ran into a problem where because the overlayed file does not reference a library that the overlay file does, I get this. I'm assuming it has to do with symbol load order or something?

../../../../path/to/file.go:6:2: could not import io (open : no such file or directory)
../../../../path/to/file.go:7:2: could not import net/http (open : no such file or directory)
snow marsh
#

never heard of -overlay before / til - what's your objective/problem you're trying to solve with it ?

simple perch
#

Team doesn't want to let me update internal library to allow an exclusion for testing, because "EnVs CoUlD bE sCaRrY", so for localized testing I'm thinking about either:
A. Using an overlay to force it to be mock code
B. Using a replace directive, but then I'd have to mock out the entire freaking library and there are multiple versions and sub folders so it'd be annoying to implement.

#

Also thinking about build tags and just isolate them behind tagged compilation w_think

snow marsh
#

build tags sounds cleaner, for code you have access to

simple perch
#

It's definitely a hard one because while I have access, it's not easy access to get things merged. Plus then I have to update all consumers

snow marsh
#

you wouldn’t, you would only use tags for your special case and everything else would have default/normal/prod behavior

simple perch
#

For a system that needs all components to spin up locally for localized testing you would; any out of date versions wouldn't support the tag.

#

Which, for a micro service infrastructure, is like 18 services. Nightmare of a situation.