Error: <.Resource.GetMatch>: can't evaluate field Resource in type goldmark.imageLinkContext`

Great.
And the code is simpler too.
But I get an error "Error: add site dependencies: load resources: loading templates: "/home/drm/WEBSITE/themes/hugo-book/layouts/_default/_markup/render-image.html:40:1": parse failed: template: _default/_markup/render-image.html:40: unexpected EOF
and it’s annoying af, because it gives no more information and I can’t seem to pin-point the syntax typo. Is there somewhere a code validator for go+html or somethin’ ?

Without that typo, normally,

{{ $img := .Page.Resources.GetMatch .Destination }}
{{ if and (not $img) .Page.File }}
{{ $path := path.Join .Page.File.Dir .Destination }}
{{ $img = resources.Get $path }}
{{ end }}
{{ with $img }}
{{ $largest := $img.Resize "1500x" }}
{{ $large := $largest.Resize "1200x" }}
{{ $medium := $large.Resize "900x" }}
{{ $small := $medium.Resize "400x" }}

{{if .IsBlock}}

<figure>{{ with .Title }}<figcaption>{{.|$.Page.RenderString}}</figcaption>{{ end }}<a href="{{$img.RelPermalink}}" target="_blank">

<picture>
	<source srcset="{{ $small.RelPermalink }} 400w,
			        {{ $medium.RelPermalink }} 900w,
			        {{ $large.RelPermalink }} 1200w,
			        {{ $largest.RelPermalink }} 1500w"/>
	<img src="{{ $medium.RelPermalink }}" loading="{{with .Attributes.loading}}{{.}}{{else}}lazy{{end}}" alt="{{ default (.Title|$.Page.RenderString) .Text }}" {{ with .Title }}title="{{ markdownify . }}"{{ end }}/>
</picture>
</a></figure>

{{ else }}

<span> {{ with .Title }}<span>{{.|$.Page.RenderString}}</span>{{ end }}<a href="{{$img.RelPermalink}}" target="_blank">

<picture>
	<source srcset="{{ $small.RelPermalink }} 400w,
			        {{ $medium.RelPermalink }} 900w,
			        {{ $large.RelPermalink }} 1200w,
			        {{ $largest.RelPermalink }} 1500w"/>
	<img src="{{ $medium.RelPermalink }}" loading="{{with .Attributes.loading}}{{.}}{{else}}lazy{{end}}" alt="{{ default (.Title|$.Page.RenderString) .Text }}" {{ with .Title }}title="{{ markdownify . }}"{{ end }}/>
 </picture>

 </a></span>
{{ end }}

should work just fine, close.
Also I remove the - in Go tags because I have no idea what they do and never needed them.