caddy-esi icon indicating copy to clipboard operation
caddy-esi copied to clipboard

Build issues `undefined: "github.com/corestoreio/errors".NewWriteFailed`

Open shift opened this issue 7 years ago • 3 comments

Unable to build. The following errors are produced.

# github.com/corestoreio/caddy-esi/esitag
../../../corestoreio/caddy-esi/esitag/data_tag.go:121:20: undefined: "github.com/corestoreio/errors".NewWriteFailed
../../../corestoreio/caddy-esi/esitag/data_tag.go:155:23: undefined: "github.com/corestoreio/errors".NewWriteFailed
../../../corestoreio/caddy-esi/esitag/data_tag.go:177:24: undefined: "github.com/corestoreio/errors".NewWriteFailed
../../../corestoreio/caddy-esi/esitag/data_tag.go:183:24: undefined: "github.com/corestoreio/errors".NewWriteFailed
../../../corestoreio/caddy-esi/esitag/data_tag.go:190:25: undefined: "github.com/corestoreio/errors".NewWriteFailed
../../../corestoreio/caddy-esi/esitag/data_tag.go:199:24: undefined: "github.com/corestoreio/errors".NewWriteFailed
../../../corestoreio/caddy-esi/esitag/data_tag.go:205:24: undefined: "github.com/corestoreio/errors".NewWriteFailed
../../../corestoreio/caddy-esi/esitag/data_tag.go:211:24: undefined: "github.com/corestoreio/errors".NewWriteFailed
../../../corestoreio/caddy-esi/esitag/data_tag.go:222:23: undefined: "github.com/corestoreio/errors".NewWriteFailed
../../../corestoreio/caddy-esi/esitag/data_tag.go:228:23: undefined: "github.com/corestoreio/errors".NewWriteFailed
../../../corestoreio/caddy-esi/esitag/data_tag.go:228:23: too many errors

shift avatar May 23 '18 10:05 shift

That won't get fixed too soon.

SchumacherFM avatar Jun 05 '18 06:06 SchumacherFM

hey @SchumacherFM It looks pretty interesting in terms of the architecture using ESI tags and a Caddy proxy.

Regarding the errors, i can se what your trying to do in terms of returning errors with context designed for ESI ( i assume ). It looks like only one file has then, so maybe for now we can just wrap the calling code to return normal errors OR ESI style errors.

How the code is now:

if dts.Len() == 0 || dataLen == 0 {
		wn, err := w.Write(data)
		nWritten += wn

		return nWritten, errors.NewWriteFailed(err, "[esitag] Failed to write")
	}

Suggested quick fix:

var useEsiError = true

	if dts.Len() == 0 || dataLen == 0 {
		wn, err := w.Write(data)
		nWritten += wn
		if useEsiError {

			//TODO: return nWritten, errors.NewWriteFailed(err, "[esitag] Failed to write")
		}
		return nWritten, errors.WithMessage(err, "[esitag] Failed to write")
	}

This is just to stub out the code thats stopping compilation for now. I think its maybe 10 to 15 locations in that one file.

ghost avatar Feb 02 '19 16:02 ghost

Hi @gedw99

thanks for looking into this. But it needs a total refactor instead of commenting out the old code.

I've refactored the errors and the code does now compile but there are architectural errors because of the changed caddy middlewares. So caddy-esi does not work as expected.

I might be looking into this in the next couple of months.

SchumacherFM avatar Feb 03 '19 17:02 SchumacherFM