From 5446a7b5b11e10ca6e67db961a1e2db1e2038571 Mon Sep 17 00:00:00 2001 From: Hamza El-Saawy Date: Thu, 16 Apr 2026 17:51:36 -0400 Subject: [PATCH] Use VS SDK to create syso file from Manifest Switch from using `github.com/josephspurrier/goversioninfo/cmd/goversioninfo` and checked in `*.syso` binary files to using Windows SDK to generate resource object files with embedded manifest directly. Auto-generate manifest XML using common template instead of having redundant files throughout repo. Add *.syso to `.gitignore` to keep binaries from being tracked or checked in. Signed-off-by: Hamza El-Saawy --- .github/workflows/ci.yml | 34 +- .gitignore | 5 + .../containerd-shim-lcow-v2.exe.manifest | 17 - cmd/containerd-shim-lcow-v2/main.go | 2 +- .../resource_windows_386.syso | Bin 1526 -> 0 bytes .../resource_windows_amd64.syso | Bin 1526 -> 0 bytes .../resource_windows_arm.syso | Bin 1526 -> 0 bytes .../resource_windows_arm64.syso | Bin 1526 -> 0 bytes cmd/containerd-shim-lcow-v2/versioninfo.json | 44 --- .../containerd-shim-runhcs-v1.exe.manifest | 16 - cmd/containerd-shim-runhcs-v1/main.go | 2 +- .../resource_windows_386.syso | Bin 1486 -> 0 bytes .../resource_windows_amd64.syso | Bin 1486 -> 0 bytes .../resource_windows_arm.syso | Bin 1486 -> 0 bytes .../resource_windows_arm64.syso | Bin 1486 -> 0 bytes .../versioninfo.json | 43 --- cmd/ncproxy/main.go | 2 + cmd/ncproxy/ncproxy.exe.manifest | 10 - cmd/ncproxy/resource_windows_386.syso | Bin 1260 -> 0 bytes cmd/ncproxy/resource_windows_amd64.syso | Bin 1260 -> 0 bytes cmd/ncproxy/versioninfo.json | 43 --- cmd/runhcs/main.go | 2 +- cmd/runhcs/resource_windows_386.syso | Bin 966 -> 0 bytes cmd/runhcs/resource_windows_amd64.syso | Bin 966 -> 0 bytes cmd/runhcs/resource_windows_arm.syso | Bin 966 -> 0 bytes cmd/runhcs/resource_windows_arm64.syso | Bin 966 -> 0 bytes cmd/runhcs/runhcs.exe.manifest | 10 - cmd/runhcs/versioninfo.json | 43 --- cmd/wclayer/resource_windows_386.syso | Bin 966 -> 0 bytes cmd/wclayer/resource_windows_amd64.syso | Bin 966 -> 0 bytes cmd/wclayer/resource_windows_arm.syso | Bin 966 -> 0 bytes cmd/wclayer/resource_windows_arm64.syso | Bin 966 -> 0 bytes cmd/wclayer/versioninfo.json | 43 --- cmd/wclayer/wclayer.exe.manifest | 10 - cmd/wclayer/wclayer.go | 2 +- go.mod | 5 - go.sum | 4 - internal/tools/uvmboot/main.go | 2 + .../tools/uvmboot/resource_windows_386.syso | Bin 968 -> 0 bytes .../tools/uvmboot/resource_windows_amd64.syso | Bin 968 -> 0 bytes scripts/New-ResourceObjectFile.ps1 | 232 +++++++++++ scripts/Set-VersionInfo.ps1 | 2 +- test/go.mod | 5 - test/go.sum | 4 - test/pkg/manifest/manifest.go | 2 +- test/pkg/manifest/manifest.xml | 10 - test/pkg/manifest/resource_windows_386.syso | Bin 990 -> 0 bytes test/pkg/manifest/resource_windows_amd64.syso | Bin 990 -> 0 bytes test/pkg/manifest/resource_windows_arm.syso | Bin 990 -> 0 bytes test/pkg/manifest/resource_windows_arm64.syso | Bin 990 -> 0 bytes test/pkg/manifest/versioninfo.json | 43 --- vendor/github.com/akavel/rsrc/AUTHORS | 5 - vendor/github.com/akavel/rsrc/LICENSE.txt | 21 - .../github.com/akavel/rsrc/binutil/plain.go | 13 - .../akavel/rsrc/binutil/sizedfile.go | 35 -- vendor/github.com/akavel/rsrc/binutil/walk.go | 63 --- .../github.com/akavel/rsrc/binutil/writer.go | 33 -- vendor/github.com/akavel/rsrc/coff/coff.go | 363 ------------------ vendor/github.com/akavel/rsrc/ico/ico.go | 214 ----------- .../goversioninfo/.gitattributes | 8 - .../josephspurrier/goversioninfo/.gitignore | 19 - .../josephspurrier/goversioninfo/LICENSE | 21 - .../josephspurrier/goversioninfo/Makefile | 26 -- .../josephspurrier/goversioninfo/README.md | 127 ------ .../goversioninfo/cmd/goversioninfo/main.go | 290 -------------- .../goversioninfo/goversioninfo.go | 362 ----------------- .../josephspurrier/goversioninfo/icon.go | 121 ------ .../josephspurrier/goversioninfo/lang_cs.go | 131 ------- .../goversioninfo/structbuild.go | 330 ---------------- vendor/modules.txt | 9 - 70 files changed, 272 insertions(+), 2556 deletions(-) delete mode 100644 cmd/containerd-shim-lcow-v2/containerd-shim-lcow-v2.exe.manifest delete mode 100644 cmd/containerd-shim-lcow-v2/resource_windows_386.syso delete mode 100644 cmd/containerd-shim-lcow-v2/resource_windows_amd64.syso delete mode 100644 cmd/containerd-shim-lcow-v2/resource_windows_arm.syso delete mode 100644 cmd/containerd-shim-lcow-v2/resource_windows_arm64.syso delete mode 100644 cmd/containerd-shim-lcow-v2/versioninfo.json delete mode 100644 cmd/containerd-shim-runhcs-v1/containerd-shim-runhcs-v1.exe.manifest delete mode 100644 cmd/containerd-shim-runhcs-v1/resource_windows_386.syso delete mode 100644 cmd/containerd-shim-runhcs-v1/resource_windows_amd64.syso delete mode 100644 cmd/containerd-shim-runhcs-v1/resource_windows_arm.syso delete mode 100644 cmd/containerd-shim-runhcs-v1/resource_windows_arm64.syso delete mode 100644 cmd/containerd-shim-runhcs-v1/versioninfo.json delete mode 100644 cmd/ncproxy/ncproxy.exe.manifest delete mode 100644 cmd/ncproxy/resource_windows_386.syso delete mode 100644 cmd/ncproxy/resource_windows_amd64.syso delete mode 100644 cmd/ncproxy/versioninfo.json delete mode 100644 cmd/runhcs/resource_windows_386.syso delete mode 100644 cmd/runhcs/resource_windows_amd64.syso delete mode 100644 cmd/runhcs/resource_windows_arm.syso delete mode 100644 cmd/runhcs/resource_windows_arm64.syso delete mode 100644 cmd/runhcs/runhcs.exe.manifest delete mode 100644 cmd/runhcs/versioninfo.json delete mode 100644 cmd/wclayer/resource_windows_386.syso delete mode 100644 cmd/wclayer/resource_windows_amd64.syso delete mode 100644 cmd/wclayer/resource_windows_arm.syso delete mode 100644 cmd/wclayer/resource_windows_arm64.syso delete mode 100644 cmd/wclayer/versioninfo.json delete mode 100644 cmd/wclayer/wclayer.exe.manifest delete mode 100644 internal/tools/uvmboot/resource_windows_386.syso delete mode 100644 internal/tools/uvmboot/resource_windows_amd64.syso create mode 100644 scripts/New-ResourceObjectFile.ps1 delete mode 100644 test/pkg/manifest/manifest.xml delete mode 100644 test/pkg/manifest/resource_windows_386.syso delete mode 100644 test/pkg/manifest/resource_windows_amd64.syso delete mode 100644 test/pkg/manifest/resource_windows_arm.syso delete mode 100644 test/pkg/manifest/resource_windows_arm64.syso delete mode 100644 test/pkg/manifest/versioninfo.json delete mode 100644 vendor/github.com/akavel/rsrc/AUTHORS delete mode 100644 vendor/github.com/akavel/rsrc/LICENSE.txt delete mode 100644 vendor/github.com/akavel/rsrc/binutil/plain.go delete mode 100644 vendor/github.com/akavel/rsrc/binutil/sizedfile.go delete mode 100644 vendor/github.com/akavel/rsrc/binutil/walk.go delete mode 100644 vendor/github.com/akavel/rsrc/binutil/writer.go delete mode 100644 vendor/github.com/akavel/rsrc/coff/coff.go delete mode 100644 vendor/github.com/akavel/rsrc/ico/ico.go delete mode 100644 vendor/github.com/josephspurrier/goversioninfo/.gitattributes delete mode 100644 vendor/github.com/josephspurrier/goversioninfo/.gitignore delete mode 100644 vendor/github.com/josephspurrier/goversioninfo/LICENSE delete mode 100644 vendor/github.com/josephspurrier/goversioninfo/Makefile delete mode 100644 vendor/github.com/josephspurrier/goversioninfo/README.md delete mode 100644 vendor/github.com/josephspurrier/goversioninfo/cmd/goversioninfo/main.go delete mode 100644 vendor/github.com/josephspurrier/goversioninfo/goversioninfo.go delete mode 100644 vendor/github.com/josephspurrier/goversioninfo/icon.go delete mode 100644 vendor/github.com/josephspurrier/goversioninfo/lang_cs.go delete mode 100644 vendor/github.com/josephspurrier/goversioninfo/structbuild.go diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e6ae0606d6..4561ecd0a6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,8 +4,8 @@ on: - pull_request env: - GO_BUILD_CMD: 'go build "-ldflags=-s -w" -trimpath' - GO_BUILD_TEST_CMD: "go test -mod=mod -gcflags=all=-d=checkptr -c -tags functional" + GO_BUILD_CMD: 'go build "-ldflags=-s -w -linkmode=external" -trimpath' + GO_BUILD_TEST_CMD: 'go test -mod=mod "-ldflags=-linkmode=external" -gcflags=all=-d=checkptr -c -tags functional' GOTESTSUM_VERSION: "latest" @@ -319,21 +319,28 @@ jobs: # accept the eula & '${{ github.workspace }}/bin/psexec' -accepteula -nobanner cmd /c "exit 0" + - name: Generate Resource Object Files + shell: pwsh + run: | + go generate -x ./cmd/... + cd test + go generate -x ./... + # run tests - name: Test rego security policy - run: ${{ env.GOTESTSUM_CMD }} -tags=rego -timeout=30m -gcflags=all=-d=checkptr ./pkg/securitypolicy/... + run: ${{ env.GOTESTSUM_CMD }} -ldflags=-linkmode=external -gcflags=all=-d=checkptr -tags=rego -timeout=30m ./pkg/securitypolicy/... - name: Test repo - run: ${{ env.GOTESTSUM_CMD }} -gcflags=all=-d=checkptr -tags admin -timeout=20m ./... + run: ${{ env.GOTESTSUM_CMD }} -ldflags=-linkmode=external -gcflags=all=-d=checkptr -tags=admin -timeout=20m ./... - name: Test lcow tagged packages (shimV2) - run: ${{ env.GOTESTSUM_CMD }} -gcflags=all=-d=checkptr -tags lcow -timeout=10m ./... + run: ${{ env.GOTESTSUM_CMD }} -ldflags=-linkmode=external -gcflags=all=-d=checkptr -tags=lcow -timeout=10m ./... - name: Test wcow tagged packages (shimV2) - run: ${{ env.GOTESTSUM_CMD }} -gcflags=all=-d=checkptr -tags wcow -timeout=10m ./... + run: ${{ env.GOTESTSUM_CMD }} -ldflags=-linkmode=external -gcflags=all=-d=checkptr -tags=wcow -timeout=10m ./... - name: Run non-functional tests - run: ${{ env.GOTESTSUM_CMD }} -mod=mod -gcflags=all=-d=checkptr ./internal/... ./pkg/... ./parity/... + run: ${{ env.GOTESTSUM_CMD }} -ldflags=-linkmode=external -gcflags=all=-d=checkptr -mod=mod -timeout=10m ./internal/... ./pkg/... ./parity/... working-directory: test - name: Build and run containerd-shim-runhcs-v1 tests @@ -537,8 +544,10 @@ jobs: - name: Build the shim working-directory: src/github.com/Microsoft/hcsshim - shell: powershell + shell: pwsh run: | + go generate -x ./cmd/containerd-shim-runhcs-v1 + ${{ env.GO_BUILD_CMD }} -mod vendor -o "${{ github.workspace }}/src/github.com/containerd/containerd/bin/containerd-shim-runhcs-v1.exe" .\cmd\containerd-shim-runhcs-v1 - name: Install gotestsum @@ -655,6 +664,13 @@ jobs: $LASTEXITCODE = 0 } + - name: Generate Resource Object Files + shell: pwsh + run: | + go generate -x ./cmd/... + cd test + go generate -x ./... + - run: ${{ env.GO_BUILD_CMD }} -tags lcow ./... name: Build lcow tagged packages (shimV2) - run: ${{ env.GO_BUILD_CMD }} -tags wcow ./... @@ -693,7 +709,7 @@ jobs: name: Build rootfs.exe - run: ${{ env.GO_BUILD_CMD }} ./internal/tools/securitypolicy name: Build securitypolicy.exe - - run: ${{ env.GO_BUILD_CMD }} ./internal/tools/securitypolicy + - run: go build "-ldflags=-s -w" -trimpath ./internal/tools/securitypolicy name: Build securitypolicy env: GOOS: linux diff --git a/.gitignore b/.gitignore index d8695f7e16..2e6968186a 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,11 @@ *.so *.dylib +# manifest related generated files +*.syso +manifest.xml +*.exe.manifest + # Ignore vscode setting files .vscode/ .idea/ diff --git a/cmd/containerd-shim-lcow-v2/containerd-shim-lcow-v2.exe.manifest b/cmd/containerd-shim-lcow-v2/containerd-shim-lcow-v2.exe.manifest deleted file mode 100644 index 9c5ba67277..0000000000 --- a/cmd/containerd-shim-lcow-v2/containerd-shim-lcow-v2.exe.manifest +++ /dev/null @@ -1,17 +0,0 @@ - - - containerd-shim-lcow-v2 - - - - - - - - - - true - - - - diff --git a/cmd/containerd-shim-lcow-v2/main.go b/cmd/containerd-shim-lcow-v2/main.go index 9951144a8a..86f1a02ca7 100644 --- a/cmd/containerd-shim-lcow-v2/main.go +++ b/cmd/containerd-shim-lcow-v2/main.go @@ -23,7 +23,7 @@ import ( ) // Add a manifest to get proper Windows version detection. -//go:generate go tool github.com/josephspurrier/goversioninfo/cmd/goversioninfo -platform-specific +//go:generate pwsh -Command "../../scripts/New-ResourceObjectFile.ps1 -ErrorAction 'Stop' -Destination '.' -Name 'containerd-shim-lcow-v2' -UseVersionFile -Architecture 'all'" func main() { logrus.AddHook(log.NewHook()) diff --git a/cmd/containerd-shim-lcow-v2/resource_windows_386.syso b/cmd/containerd-shim-lcow-v2/resource_windows_386.syso deleted file mode 100644 index 5510dc97e267524a0f754dca07ffaf1a52d3b161..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1526 zcma)6O>Pr06n<%oP$MC+?1F_Ev7?ho(zGPeB;~J_Dz&sCr7Xdj@gyV7c%re>v_eQd zLXW@^xBxfc2wiXkZh-jgNz#O}s1w`I_V>Q``PrVsQi)9Y^?<0b)=HIJ<$;|onrp22 zFn^*qWd-%6{hQIOtk7eajOc0u{Rw(>3#DZFoBx?#U%N92zXCtJvs5C3zXswP>P;aU z7Jv};Xw{mwxhXZ!pHYuKq1~hRuny>$-eG)zb|1DWKh}Q#DRw_2EBal#O0`FrRp#tgDi~YpyPZv-FKS~Q<}?= zCz%u-=TazVw_EnPQX=gqmkj<=b)0c7+bS4}lq)xlgFI7Nq}?D(+gzoU^P0m_F5^fj zeYO~^TV^PJC{&QgBMlMVAd{NMQskklhH>g9K{j#E>%O-LD%?On;yUifNv!XoWC?CG z716B%J{l!)05T}B^Se=jSg&_6)HENPr06n<&LqLGkTcEQ4o*wM)(XJjqBio@neetq@XI zta}8Gzy-JgN9ckZa0A3=Pm(5t1x{=~+u!@%=VyDuFC{YN=RKmrDwnFc$^$!FG&flD zVg5jG${Ol3`!}OmS)&Iq8PWA7`cw4i7D~zTxBfA|QC^vZUx6R4ES1RMZ-DrUdRvHw z1t5goU$>@hZc9z{=hUMQXbAL$`{PHeP+jmQyg7E{i>19(VyaElSZhvb51h;a%l0dqzZSQpfwDk5Im zsD-9e8#SacPB&E^9=O zk#C|iteV^?Xy#BeVTLnXra^Rk;o2#^XQFmC%WgH2m z&liJrD-6XCg$nX`q#>dkWK#23iad1HFizbh$R_SZ!}k_Jg&XKcT*v)5iS>UdS%Mo) zMRcoxk48xxfD8&OxtTS^f8@ICeJsOlqFBB5Wb1BF-(o$HBYCV*tM7Vf_RusMrrBZ0 z8H>hxoD1f2oielee+F*h87hwN+R@;ktF}r`A$pJg%ddLnW?QH_o>)OytRyy@Mj&hJJQV!ht+kxARGH%;)2U_pUB12DC5{{}|H^9j#ISLb8l td#m&Fv%})DsA)cy^M*7|FLJk1!F#wij{;@gejN*I@mp@bVe9s7{Q*^-NXGyG diff --git a/cmd/containerd-shim-lcow-v2/resource_windows_arm.syso b/cmd/containerd-shim-lcow-v2/resource_windows_arm.syso deleted file mode 100644 index 2706f485e11faac117291c1c25087286b160ba81..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1526 zcma)6O>Pr06n<&TqLGkTcEQ4o*wM)(XJjqBio@neetq@X= z&?9gJF2If@N9ckZa0A3=Pm(5t1x{=~+u!@%=VyDqmr7*H&wE6LwNa|%Di7>z(cECo zhxr4&DQl?D?B9%LWsM%dWJK3n=ugq3TPP*V-~7k?=Elk-{0jVVWvN64e*?r9)Z0Qd zEC3ns{p+<;7^pPII=fp-E*oYj_W-;a5JAj9T2e%jjd`K>Mh8U-?5-?{pfptN3svzQ} zjaq0rwNXPF1ErTV&HUJ$i>OJP(6sDx4z?Va*yrUd;wyp_XtW9LU)Y?y^So z82KhT!>Y-Rf@TgiGe*Mse>DK|_b=0gU5H%8nd~^VO4VUP23Z)(LC1M_cIY-8rZkr! zPckVw&XrKkez)v%r9|3Kt{D8K>Nw+EwpB0`DOYY92YIHlNV`Fnwz*0x7d3~aT*i@5 z`g}21x6DxdP^ch}M;ao!K_)eirN~294dc{Jf^6bm)O~LeRJehD#C6<{lUVPr06n<&TqLGkTcEQ4o*wM)(XJjqBio@neetq@X= z&?B&B#Ra$lN9ckZa0A3=Pm(5t1x{=~+u!@%=VyDuuO%|&=RKmr+9*|Wl?QgVXl}6P z!~B8Xlr_|6_HRbBvPKVJGNS7(^rz_2EtHbwZ~kL`b7N%^eg%HGvQ#32zX9S4>TMw! z7Jv|Tf8Cn4xh*x&pHq)Mpgo|su#V`2-e7!$_7Juy-#32!E_Od7EBbxAO0QFVb$bDK{JP%86)BRzZn4e`4Om>`FrRp#tgDi~YpyRwdJ9L{4Q<}?= zCz%u-=SnDNzgzaXQX=gqR}B7Ab)0c7+bS4}lq)xlgFI7Nq}?D(+gzoUi<-kyF5^fj zeZCm1TV^PJC{&QgBMlMVAd{NMQskklhH>g9K{jzO>b|!KD%?On;yUifNv!`v$r9XX zDxzBjd^Aep0Ax^L$<3@O{v+3A?_(Ke6UA!PC);;}+BWNn9LZz#YHiO$(?V0Pn`W0G zXDk})aW0ta{>7=rqfwS?5uWteQP^=lHAOXg%4>DEAN62oielee+F*h87hwN+Ry&J%F}r`A$pJg%ddLnW?QT2{9)OytRyy@Mj% - - containerd-shim-runhcs-v1 - - - - - - - - - - true - - - diff --git a/cmd/containerd-shim-runhcs-v1/main.go b/cmd/containerd-shim-runhcs-v1/main.go index 77d51b61ed..d805903ea9 100644 --- a/cmd/containerd-shim-runhcs-v1/main.go +++ b/cmd/containerd-shim-runhcs-v1/main.go @@ -31,7 +31,7 @@ const usage = `` const ttrpcAddressEnv = "TTRPC_ADDRESS" // Add a manifest to get proper Windows version detection. -//go:generate go tool github.com/josephspurrier/goversioninfo/cmd/goversioninfo -platform-specific +//go:generate pwsh -Command "../../scripts/New-ResourceObjectFile.ps1 -ErrorAction 'Stop' -Destination '.' -Name 'containerd-shim-runhcs-v1' -UseVersionFile -Architecture 'all'" // `-ldflags '-X ...'` only works if the variable is uninitialized or set to a constant value. // keep empty and override with data from [internal/version] only if empty to allow diff --git a/cmd/containerd-shim-runhcs-v1/resource_windows_386.syso b/cmd/containerd-shim-runhcs-v1/resource_windows_386.syso deleted file mode 100644 index 7a73623fb6049daa2a81be152776314456d37d77..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1486 zcma)6%Wl&^6umA%s1Xa6tdOzTI=0&s(#T19w3RBgv?8S}(Zn9dmg2GHagtUDi6u)u zfdwDHk_|t?x_kZrab}#P4q?&T&hwso?wLCi9~%ZK`*D}3nl+48A&WroR$UCAkLfpz z$~MrR>wmRc*akho)Fk@!5aSs}3^g+}f9F5@n~k+i#8vos&1I0ne*xkv+I1xwGosHB z_DhMI+qKcg?1BdL9{mBm!R&}m={43z=npYh_OtQ(Pj&hQSvBryFHr-33(tIu_OW4r zucU$!5;Ou^LSy1!78Fqips6t~waKMjv^Kp&PZ*nseFaQPIWgd`poU?^HT?;g0`O)e z(IVs^3h5DIPIb1C&d88$ky9+A14IZ!Fpc5Bhh&2%#yZ8Upb7jj_$5|T@~DNZmpXHY z?jy&U&Kv?4fTymj9&0W+i8{2o7Iy*00+>YWp?M}3*{Y@vx{qeyW*Cr*liXB~=n3jh zbPlhok;Hi!6fGDD@8G)vkiU1Cj?F1AWRi)V<+WVPSL6&xzOj}dWGE*j!h|BV# zo~++AVSdPEP$YQ?5&a+&B})V^LR-d3Y8Mj`2hyH;zEg))fk=?EG8rc0q`ZZe6}VDW z<<}Zmo{y6NWYD0=)vhxCv2C005)o!IX?m_{+yD6GB+s*=15OZR(jZH>|Y>S*?866@*Ac7eT2RJdFc z-HFcN)ishhFN2~5BjFu<*8mFkFVl&2!3&vWqHFt2&$hS-vnUbcuKnih$Z6Y_R7^x{ zk_q0mueh}LdyRle$%t?3qNqHurd${a;B1DGD*}ew5-6j zsxrUP!18>Ogdl?kL#}tV1rHs^dYgzSn@P*}EXVoBFQ<8)6^chE1FIi(?e}f&jh--n z+Zm3AJ5FoF+s<&0?K-XYDBAUyzsvU62iv`&3EZ{pfx9BM#0C}EEi1oMJ)=I!%S?=| zQ>J3;P_W^Ir(CF&GX=BqtOKqTo`EbAb!KwAYsX6E9oL=TbaQ#rO^9^|$9;F(^B=qO zVl40DUPHg`n-Aco`ReJN PO{#vQ^|xu${8s(~W?4N~ diff --git a/cmd/containerd-shim-runhcs-v1/resource_windows_arm.syso b/cmd/containerd-shim-runhcs-v1/resource_windows_arm.syso deleted file mode 100644 index 87ee735d8640208556ca1d9ce712dcf1d12f11fa..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1486 zcma)6%Wl&^6umBCLBxV3D`YITj_o#uG;&fNZKX(*R-}|An%LvmQarXiPSOe?v1G|7 zu;2q&vSG(puO3aZP^=rU1Md zNwf$#h(daRm=m3CtTQrXTjmt2=l~G{5lmw^@FCgYiLp*GD`*OT41S5#j67-~>xItT zp}WX&sxybc1>mXcs>hluPNELo*@!y_V*yN}_0S@di)>X>2R%SDa5D_ZrqNAw7F zCpv>y)kxyJ42qVFgm>^w0m$FKNGIlu7c$92&+=NXWpWW@VIsyo>&@Ab-LXtrG7+*# zCV0=fE^QS$I)Xb!@j^}fU1=n3<- z?NKz^vD*>v*rPqRYqvX5xa%@+m+i3+mUB(xI~&=3XH9H{^=q&jR(_{`Ms<>xnHZa= ztc=Y=!A29Fa#60G$)8te9rCioGmurH?p$v7thg-muH!6jy0yCL7Q{Nkf$wxm566^R`7mVOu6rD?yv3v&UI0XdaTzCWn4VVep9{f>kr_T{_3fn PEvkQ`)wk)E{;m84kIy|Y diff --git a/cmd/containerd-shim-runhcs-v1/resource_windows_arm64.syso b/cmd/containerd-shim-runhcs-v1/resource_windows_arm64.syso deleted file mode 100644 index 475fb2bdb3d3447dc54f314ac90141ca81ea431a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1486 zcma)6zi-n(6n-gTAYx!-LdIfsY_}<-k(2VHtrUsUij*>*L+J4r5|0z$uBrC^#<0Y!&Z|PZV(E&DU z;8RpkLW0I%OK3tI%z{Rg0caVFM=kPb53NPd(G$i7VqXB0Qceu`OQ>O3aYKI$rVzXt zNwg7i5JmI=F()S5*kokLw#+G3(IFxPBACH&;3IOt6JwoXR?rmw82l2e8Tr&i)(exl zO?Q#w)MSo;3&B&>RgJY)oJ4K9vk`X=#sZkc=%Ga>582A54|;%B!_6=tmnXTd9?>Jz zo#+f+T_cI}GALRy65hdg4WMBEBAr+>UdSX9UE6PZw#7x5MTr=9?KfvfPTRJmVj^Ob zOz^IK$)&yDYXnS6o(?CM7UG5M+S5XGWEk_5NheLhB9qxjIboJ|m`s~9-?maFk`b5c zyqc`nuwX&NWmqJ+f{0$23B?k@i^!32k~+my#G!O%e&AMNWgrsdOeMo)lBgSKS%Yg; zWqzZ9<@qEDK?V(mT<>ZN9y*ToHW5)amzM8Yj`NRSPV+n~6pu~@RzK?6@7vrPJz@T~ zGaL!KF*Sg#w(xOkSmhJM}GAHXg1)zdp$ ORQ*QlZ__RFTlot&0zG*E diff --git a/cmd/containerd-shim-runhcs-v1/versioninfo.json b/cmd/containerd-shim-runhcs-v1/versioninfo.json deleted file mode 100644 index fee1a0170b..0000000000 --- a/cmd/containerd-shim-runhcs-v1/versioninfo.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "FixedFileInfo": { - "FileVersion": { - "Major": 1, - "Minor": 0, - "Patch": 0, - "Build": 0 - }, - "ProductVersion": { - "Major": 1, - "Minor": 0, - "Patch": 0, - "Build": 0 - }, - "FileFlagsMask": "3f", - "FileFlags ": "00", - "FileOS": "040004", - "FileType": "01", - "FileSubType": "00" - }, - "StringFileInfo": { - "Comments": "", - "CompanyName": "Microsoft", - "FileDescription": "", - "FileVersion": "", - "InternalName": "", - "LegalCopyright": "", - "LegalTrademarks": "", - "OriginalFilename": "containerd-shim-runhcs-v1.exe", - "PrivateBuild": "", - "ProductName": "runhcs shim", - "ProductVersion": "v1.0.0.0", - "SpecialBuild": "" - }, - "VarFileInfo": { - "Translation": { - "LangID": "0409", - "CharsetID": "04B0" - } - }, - "IconPath": "", - "ManifestPath": "containerd-shim-runhcs-v1.exe.manifest" -} \ No newline at end of file diff --git a/cmd/ncproxy/main.go b/cmd/ncproxy/main.go index 319b0d2759..e1b033c1cb 100644 --- a/cmd/ncproxy/main.go +++ b/cmd/ncproxy/main.go @@ -8,6 +8,8 @@ import ( "github.com/sirupsen/logrus" ) +//go:generate pwsh -Command "../../scripts/New-ResourceObjectFile.ps1 -ErrorAction 'Stop' -Destination '.' -Name 'ncproxy' -UseVersionFile -Architecture 'all'" + func main() { if err := app().Run(os.Args); err != nil { logrus.Fatal(err) diff --git a/cmd/ncproxy/ncproxy.exe.manifest b/cmd/ncproxy/ncproxy.exe.manifest deleted file mode 100644 index dfe8b5794f..0000000000 --- a/cmd/ncproxy/ncproxy.exe.manifest +++ /dev/null @@ -1,10 +0,0 @@ - - - ncproxy - - - - - - - diff --git a/cmd/ncproxy/resource_windows_386.syso b/cmd/ncproxy/resource_windows_386.syso deleted file mode 100644 index f0d338b8b9feb01668b95e621771f3dc06e49bb8..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1260 zcmb7E+iuh_5X}lC#C`#fk>9<}eUmEL!UKqvia;v2S0|pd7KsyL@3s{};uH8Vp7|ce z-EO+umQt+vlJWS=#m93rnK-une(X4#mE+6?Jye&{&F~ZVa$Nqx**2^9{PMGZ+ct5Y z;S&3gtz@T+z)73mm!U6NNJhzm_}(WVvqYV&-i!3{tn>R$vmm%2~9olX%vJR&Em48X(+rp z5uV`l^j?672X&A_NaL`~XcR?0EqPW^kz^v`5lx-ZNYA#E71BsEcnT73;IGEXs>Np$c>$x-4Wc4 zgj)WhkJ>C%-EBSj$7>jKr=eO6$oVm>0lu#AjevMJ$hBe+5=8c9OKC=XBp1%O6TEWg`Fp diff --git a/cmd/ncproxy/resource_windows_amd64.syso b/cmd/ncproxy/resource_windows_amd64.syso deleted file mode 100644 index 0d1ac58894b06b24e8afb81403611ff67a40ea9f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1260 zcmb7EOK;RL5KdJt>@VOL`R;Yzn^eh`9zb0Q1X6ijop{n(Bu)|Kv<+%KXvu#%I`PFCtHf_&& zhD+?a-y5-@T+M zakb$}@TOBxkW0|ya6ZYo*3g#CrHkj4F356F2f8|gmTTI|YUp%V8(MYk0oUzx~acOeS$ zH3hGpaX+ACU4}HOA*E%;V;ZHkh&}GdJmcR8`#XSNC$prQB{cQGr%@1QG>glUrlIia zM0kSF(gy(|9@Ie!A&tW_qfr$3wB%VuMUsh#M?8V>VSq69!xWvSvB(k(p%gTQKu{h; zkrxDUorO0c|$1AJNH8v*flkSp21DU1n4JLB$)3p{9f{t8ym zxQ!hP!u3L}y3a5WcPWpm3gak9%^M9{d}braZ4)`$b|+_JR7epF`uf4oC$?_bT4LM& NP6e~oYTvQt~S`0LjB z&>JGVpmTZy`;1;9n$s!0zG)D4{jQU|FEEBnu9MexeNp)C0Ozr06Ns z15yCFJB{c8_9VJMRe-}{8v*8)k#KJ}4nWcDeV(z6EUhwn;s?Ef&!mn`qV(m&e|2%f zL!a47=tN{j%ZYy_tv{P~BVnz~m)R9VzqS*9UFstnuVgMP&sAI+Yto9xCO;B3?`;B~ zqY}#dzD3LZURZ(GyX}Q*`*hc;BT!R8zAu6?0nX3L{@GZDop&3>W6h)D# z7-Se&le?^w=sxG{wbF@sXIU^{oc~p~>!L7aC6m*0Hcux0hfogE$0B&hm+A5mAEq+o z%dr^oVVEYPfe1!oEI#`EKQvK)XL{7XwJh$p-(K*v>z>oKGmty=+ulUm|4sK!?$^)! E7fyJz0RR91 diff --git a/cmd/runhcs/resource_windows_amd64.syso b/cmd/runhcs/resource_windows_amd64.syso deleted file mode 100644 index 628336e15acee8970ff3626b89b282251930e25e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 966 zcma)5y^hmB5FTIBTq=qyC>M)%lNb`=oSXz9I4KQx;*LzqDmsXB+bdwFu#7cqa$Y z$Mx5pS~;LQ2pQ4!UHCJ2xE=9o{_r39!|q-ZeGPuSSMtc=KLPOtdekh9i0B*QuRG@> zZ-nfU&gnJmGkSq&L8tT_=LPHuVkh6bKYlj9zHM&&ysi>;@o6i+Q&b`Fz*kX8iZoq< zO;JV?%$ia%sN)WR8PW(ksr?gJqL2=eKSQUXgf`H?6h)?D zkYQj=?y^pzdz`aZN+;&6WxCxcUvbf(td%?4wdrsHRKsxo?-bB0qP4`ZA>Sz87 DotLzh diff --git a/cmd/runhcs/resource_windows_arm.syso b/cmd/runhcs/resource_windows_arm.syso deleted file mode 100644 index 36c921d0bd9e720a290133c883783a6355436b54..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 966 zcma)5y^hmB5FY2!Tq=qyC>M)%lNb`=oSXz9I4KQx;*LY zuqnz&f>~2a26fy4Fhd$aC$)b9OBB)}@@MEYl+cD^uq@G8k_CrBKhc%~>I2;>QuGw+ z0V#mopGI^adlFrsD!^f}jR14YNVvBf2cT&FF3;FjmR1=(^@IM$ws;IEUtla2zY@@+$u0esV5S3b~OjZ9e_!iu)&C`^;_Py}N!5g+`)ADU>eH$58MS{C;^XfJrybIM)%lNb`=oSXz9I4KQx;*L3= z$Mx5pTItXogpBC=F8moh+>UrPfB295VRtWyz6QVED|zJbAA$G`J!+OlMDz{um!0#G zH$rwv=kyx(8NEQXpi_E|^8)q+v6JuJA3vL4-!?aXURQ~___USZDXI{7;H#)4MVc)Nu#E3~2fTH=kJY!o~T4nUq5Bfu&NgbO+>C37A^5TSt zKC_k3iO7tWQ~yd@e?IF)!djWHvMYvuZKwXG)W-v&O* zg;uGw)pB>(tj8cxB5ho%qQVlha--L=jRw291_ic4RBEL%RsF}{TX45RGprsciXu}n z$S|-bcUdRVJSz87 DB_Oo8 diff --git a/cmd/runhcs/runhcs.exe.manifest b/cmd/runhcs/runhcs.exe.manifest deleted file mode 100644 index 0eee5a83b4..0000000000 --- a/cmd/runhcs/runhcs.exe.manifest +++ /dev/null @@ -1,10 +0,0 @@ - - - runhcs - - - - - - - diff --git a/cmd/runhcs/versioninfo.json b/cmd/runhcs/versioninfo.json deleted file mode 100644 index a9394a4000..0000000000 --- a/cmd/runhcs/versioninfo.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "FixedFileInfo": { - "FileVersion": { - "Major": 1, - "Minor": 0, - "Patch": 0, - "Build": 0 - }, - "ProductVersion": { - "Major": 1, - "Minor": 0, - "Patch": 0, - "Build": 0 - }, - "FileFlagsMask": "3f", - "FileFlags ": "00", - "FileOS": "040004", - "FileType": "01", - "FileSubType": "00" - }, - "StringFileInfo": { - "Comments": "", - "CompanyName": "", - "FileDescription": "", - "FileVersion": "", - "InternalName": "", - "LegalCopyright": "", - "LegalTrademarks": "", - "OriginalFilename": "", - "PrivateBuild": "", - "ProductName": "", - "ProductVersion": "v1.0.0.0", - "SpecialBuild": "" - }, - "VarFileInfo": { - "Translation": { - "LangID": "0409", - "CharsetID": "04B0" - } - }, - "IconPath": "", - "ManifestPath": "runhcs.exe.manifest" -} \ No newline at end of file diff --git a/cmd/wclayer/resource_windows_386.syso b/cmd/wclayer/resource_windows_386.syso deleted file mode 100644 index d6c1b22ef96f3d09f87480d57efbedc7fd08de80..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 966 zcma)5!EVz)5FNLXP;=tY1INYUx=9R)a4IK32r5NFw4x;(VPmh`mF!*1>!d^osh_|H zaNxqdM=pF5e}H&vW04XLj6FNEGjHBZcAXcVM^0|`i5jot^-5dDb+lRDAs4~@4C`bM z`lNo{u9ZEy3zrdH--A7ch1n9X<`4f7Kj`cPQP6kO`kY?Do6`xs#D0$T7`~J5ogY7&U*8rtc2;MJI(XX5?+{gRJn&Uik|IqP zU{jQl1hb};4DvVwU^PtN@3_Gy=>mBjMa`9Dt(P`#fW7Sz2ZE#1DD{pGh5?MCpr(|N8ux zhd#5F(22;5mJ@#?tv{P~BVnz~m)VA)UfYSkD)o_#FJ&$)&sAI+Yto9xCO;B3@2vx$ zE$5Xdr@-7>kd7{|`;n-{~IpZw-qB?zbmA?c$!U-DN@U)L(n!ZT~mjH@RQm F`7e9Bv}OPR diff --git a/cmd/wclayer/resource_windows_amd64.syso b/cmd/wclayer/resource_windows_amd64.syso deleted file mode 100644 index 421c14c0cee23f8a539b48619f4e53028fb567a5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 966 zcma)5!EVz)5FIzUG$#%{a9k{|o5YX^r*hH?L8V-1MN2rs#$LB8*}In4Nr@0rPn`Jx z4qUkR$c1m>4-ju{EKauM9muuk@% z$Mx%Wt?bb~xQyuLKI|DR%$9gHfB291es?E`x(0u>lk&*nKLPOtde96FkLVlxuUq>A zZ-nTA&gl)-=kyZZoKEQl_H(Q!@SS|`{`lGa`nI^SM|GB{i>J-}4p9Zi17AfYDbjQa zHbogpFl$Q5AdfQuW=JFGq_$775{0yn_!%k zKnfstyAeIaoJ1GM3UF9VBf#7;63*?`0Vq0pmuGA(ORJ2Y`ayr_GpS>fD1ABgUtOH= z&}X(1IuV)Ca_VoS^^az~NLVZLWwv3c*LLc!N_}YKE13(+a}}4ynzZ7v$q$9i`|H4G zxzH+=wpwgAoAnqZN~DcTRa6*ab{%J8Bg<&89c*BrD@3K1DpS>ebiM<3Gc?`mj-n_s z6@v^NYjPKL5pE^HC~8 zzMP0LABAZ$9*STrCgOuX_(Ky7cDhG{JHz6D2ki;Zdbp<>cUh25{k1pV_J7lTlb!m` Fe*wzcwEF-6 diff --git a/cmd/wclayer/resource_windows_arm.syso b/cmd/wclayer/resource_windows_arm.syso deleted file mode 100644 index 9123d7ad33dd986509445c6fe90559d31e8f8dec..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 966 zcma)5!EVz)5FMwvG$#%{a9k{|o5YX^r*hH?L8V-1MN2rs#$LB8*}In4Nr@0rKY%2q9yz()BWk>^*Dq}u*U@Hqi(CZv6ReXC z^tgWAu9XhmgUg6+?!%tJ!fc6G^N0V4?{{~CsB7?7J1LJG{v!~dp$E;-@QA*`|FX3| z@J5I(=$zhQeNHdo&FPe0U_Zxt0^iBE?vJ0%uWySRdsJtMx_H{m?+{gRJn&Uik|Ir) zU{jQl1hb};4DvVwV1_h;PHOuUD^W=Mh@YX-P(mw;!LmSQNfsOi^+an5s1J0j2+=dB z2c!UUw;Rzz%t>^CtN@3_Gy=>mBjMa`9e|>vcX`Ivvb4(RsUP%*K9f2&iPD!-|JB6_ z4}E4Up%alAEvNoQTK{O)i-ff@UuGMIdTpovs?>)zzLL4HJXdjPtVt^#oBUANyuS{7 zmJ6*?X{*I{vssTpqD0!bR7Hg$X4i2hHnNNc+rb6~xC(#4W*=wZ}b8T5LWSsw%x2vKsWhIl-b2d+={`*i4(4#ey9yz()BWk>^*Dq}u*U@Hqi(CZv6ReXC z^tgWAu9XhmgUg6+?!%tJ!fc6G^N0V4?{{~CsB7?7J1LJG{v!~dp$E;-@QA*_|FX3| z@J5I(=$zhQeNHdo&FPe0U_Zxt0^iB^?vJ0%uWySRdsJtMx_H{m?+{gRJn&Uik|Ir) zU{jQl1hb};4DvVwV1_h;PHOuUD^W=Mh@YX-P(mw;!LmSQNfsOi^+an5s1J0j2+=dB z2c!UUw;Rzz%t>^CtN@3_Gy=>mBjMa`9e|>vcX`Ivvb4(RsUP%*K9f2&iPD!-|JB6_ z4}E4Up%alAEvNoQTK{O)i-ff@UuGMIdTpovs?>)zzLL4HJXdjPtVt^#oBUANyuS{7 zmJ6*?X{*I{vssTpqD0!bR7Hg$X4i2hHnNNc+rb6~xC(#4W*=wZ}b8T5LWSsw%x2vKsWhIl-b2d+={`*i4(4 - - wclayer - - - - - - - diff --git a/cmd/wclayer/wclayer.go b/cmd/wclayer/wclayer.go index 9b1b125352..80b8e5103e 100644 --- a/cmd/wclayer/wclayer.go +++ b/cmd/wclayer/wclayer.go @@ -13,7 +13,7 @@ import ( ) // Add a manifest to get proper Windows version detection. -//go:generate go tool github.com/josephspurrier/goversioninfo/cmd/goversioninfo -platform-specific +//go:generate pwsh -Command "../../scripts/New-ResourceObjectFile.ps1 -ErrorAction 'Stop' -Destination '.' -Name 'wclayer' -UseVersionFile -Architecture 'all'" var usage = `Windows Container layer utility diff --git a/go.mod b/go.mod index 79893bfdd3..e3f9d4b0c8 100644 --- a/go.mod +++ b/go.mod @@ -16,9 +16,6 @@ tool ( // generate Win32 API code github.com/Microsoft/go-winio/tools/mkwinsyscall - // create syso files for manifesting - github.com/josephspurrier/goversioninfo/cmd/goversioninfo - // mock gRPC client and servers go.uber.org/mock/mockgen ) @@ -73,7 +70,6 @@ require ( cyphar.com/go-pathrs v0.2.4 // indirect github.com/OneOfOne/xxhash v1.2.8 // indirect github.com/agnivade/levenshtein v1.2.0 // indirect - github.com/akavel/rsrc v0.10.2 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/checkpoint-restore/go-criu/v7 v7.2.0 // indirect @@ -100,7 +96,6 @@ require ( github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8 // indirect github.com/golang/protobuf v1.5.4 // indirect github.com/gorilla/mux v1.8.1 // indirect - github.com/josephspurrier/goversioninfo v1.5.0 // indirect github.com/klauspost/compress v1.18.5 // indirect github.com/lestrrat-go/backoff/v2 v2.0.8 // indirect github.com/lestrrat-go/blackmagic v1.0.2 // indirect diff --git a/go.sum b/go.sum index e299a51753..ce144cee6c 100644 --- a/go.sum +++ b/go.sum @@ -377,8 +377,6 @@ github.com/ajstarks/deck v0.0.0-20200831202436-30c9fc6549a9/go.mod h1:JynElWSGnm github.com/ajstarks/deck/generate v0.0.0-20210309230005-c3f852c02e19/go.mod h1:T13YZdzov6OU0A1+RfKZiZN9ca6VeKdBdyDV+BY97Tk= github.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw= github.com/ajstarks/svgo v0.0.0-20211024235047-1546f124cd8b/go.mod h1:1KcenG0jGWcpt8ov532z81sp/kMMUG485J2InIOyADM= -github.com/akavel/rsrc v0.10.2 h1:Zxm8V5eI1hW4gGaYsJQUhxpjkENuG91ki8B4zCrvEsw= -github.com/akavel/rsrc v0.10.2/go.mod h1:uLoCtb9J+EyAqh+26kdrTgmzRBFPGOolLWKpdxkKq+c= github.com/alecthomas/assert/v2 v2.2.2/go.mod h1:pXcQ2Asjp247dahGEmsZ6ru0UVwnkhktn7S0bBDLxvQ= github.com/alecthomas/assert/v2 v2.3.0/go.mod h1:pXcQ2Asjp247dahGEmsZ6ru0UVwnkhktn7S0bBDLxvQ= github.com/alecthomas/participle/v2 v2.0.0/go.mod h1:rAKZdJldHu8084ojcWevWAL8KmEU+AT+Olodb+WoN2Y= @@ -766,8 +764,6 @@ github.com/iancoleman/strcase v0.3.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47 github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20220319035150-800ac71e25c2/go.mod h1:aYm2/VgdVmcIU8iMfdMvDMsRAQjcfZSKFby6HOFvi/w= -github.com/josephspurrier/goversioninfo v1.5.0 h1:9TJtORoyf4YMoWSOo/cXFN9A/lB3PniJ91OxIH6e7Zg= -github.com/josephspurrier/goversioninfo v1.5.0/go.mod h1:6MoTvFZ6GKJkzcdLnU5T/RGYUbHQbKpYeNP0AgQLd2o= github.com/josharian/native v1.1.0 h1:uuaP0hAbW7Y4l0ZRQ6C9zfb7Mg1mbFKry/xzDAfmtLA= github.com/josharian/native v1.1.0/go.mod h1:7X/raswPFr05uY3HiLlYeyQntB6OO7E/d2Cu7qoaN2w= github.com/jsimonetti/rtnetlink/v2 v2.0.1 h1:xda7qaHDSVOsADNouv7ukSuicKZO7GgVUCXxpaIEIlM= diff --git a/internal/tools/uvmboot/main.go b/internal/tools/uvmboot/main.go index 300c968e30..af8ad8284e 100644 --- a/internal/tools/uvmboot/main.go +++ b/internal/tools/uvmboot/main.go @@ -16,6 +16,8 @@ import ( "github.com/Microsoft/hcsshim/internal/winapi" ) +//go:generate pwsh -Command "../../../scripts/New-ResourceObjectFile.ps1 -ErrorAction 'Stop' -Destination '.' -Name 'uvmboot' -UseVersionFile -Architecture 'all'" + const ( cpusArgName = "cpus" memoryArgName = "memory" diff --git a/internal/tools/uvmboot/resource_windows_386.syso b/internal/tools/uvmboot/resource_windows_386.syso deleted file mode 100644 index b4320575e4c5c95bfe35813298ae82a61e87fa35..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 968 zcma)5!HU#C5UuPE$O?joJ$P(`*Pcmq1~W@$M?@C}#9iEVJW40&>@+0ZA)OgrMA%R8 z3&bxF5wCuee;~dj6UaIqtfacCt6sgTbdnd2L$!S0Cu+TcGc0WxH_>*9kPG2{hOK1} z`lPw*T_<~V7cL{Zz6W~-3)2&);Sc^1KN#!;QP<*EJ1K{1{3js3Ko8rY;Sv3S|FyS2 zbjFA->73qTeNM07E$Eb9V!yz80>74@gI~Yfr|*heJ8!Z?16*BZ8=?x11HOt%Ql#k; zY>G0HVAhn9K^|uSj7MYWw6RaI5(RXC_!%kewVoU(Vdu7biS$ znXQCQL}s*{xmVJ<^W!_WLt(AVqwI=-K--zSF7=U(S27ot=PE9ZHEG3TlOGA24>!Kc za-mf!ZME!o0~LdWiL`O4iV9;KmutO>Z8+-3wlMG&qEeB{RP`UNZ@}vzw(Xjhq9`&I zgAFZP`Z`=oc%O6jM(M=7v&{Dx=YIq2x+qLp$>j8$Es~l0A&_4BSojZlltz#EIF$j9 zreea!L7GfF;ZMX=d~`=Wo^Z4~KsdTFG0;G54;q_myw6&0HQ#&d_5aTLtK4ti`X87o Bw2uG) diff --git a/internal/tools/uvmboot/resource_windows_amd64.syso b/internal/tools/uvmboot/resource_windows_amd64.syso deleted file mode 100644 index d6100a85b94087599ac086568b810e2fba5e51c1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 968 zcma)5!EVz)5FIzU6bXq#4;&YZ>n1TI!l|65LbOsYw4x;((b`@&E7`l2*9lapQcs-u z0>l>}gt+oe`~l+GjwP3HVC>nMoq6+Sytd*-|z1PQP<#CJ1K`M{3js3Ko6Rs;Sv3S|FyF} zaK?x(>4M&3J)u|d7Ia20v0q?4ggKbXJIQnrzWRYuQTZ!mJ1)RBpmzM8qOFHgDe zGFu8Ai_~a2bFZa!=STPN1;SdHh3Pc|fwnVuUFbs_tz;%F&s0ZDHWcMX5rSs`5Wt-+@;{Y}?f>MV_ZB z0vlR3^i{Z$;1TESjnc7sXPGx*oc|55>pV9_DdV#Xwuoo$2VahoXTp2J!z6sl$BFcL zI298<_LF!r65d2i#f>}c@C3u%0fOP3iGc=cd(hb2;(b=qtH1Zg>;9e9SJ|uI`XA_n BwIl!l diff --git a/scripts/New-ResourceObjectFile.ps1 b/scripts/New-ResourceObjectFile.ps1 new file mode 100644 index 0000000000..e0f8c9608a --- /dev/null +++ b/scripts/New-ResourceObjectFile.ps1 @@ -0,0 +1,232 @@ +#Requires -Version 7 + +<# +.SYNOPSIS + +Generate *.syso resource files to be linked into Go binaries. + +.DESCRIPTION + +Use RC.exe and then CVTRES.exe to embed the manifest as well as other resource information +into a COFF object file that the go compiler can automatically link into the final binary. +While similar to what github.com/josephspurrier/goversioninfo/cmd/goversioninfo does +(and is intended to also be used in go:generate directives), the resulting object file is +different in structure than the `goversioninfo` output. +Specifically, it has multiple sections (.debug$S, .rsrc$01, and .rsrc$03), and causes `go build` +to fail with "sectnum < 0!" unless the `-ldflags=-linkmode=external` flag is used, +which requires enabling CGO. + +.EXAMPLE + +New-ResourceObjectFile -Destination .\cmd\runhcs -Name runhcs -Version 0.14.0 -Architecture all + +Create resource_windows_amd64.syso and resource_windows_arm64.syso files in the cmd\runhcs directory. + +.LINK + +https://learn.microsoft.com/en-us/windows/win32/sbscs/application-manifests + +.LINK + +https://learn.microsoft.com/en-us/windows/win32/menurc/about-resource-files + +#> +[CmdletBinding()] +param ( + [ValidateNotNullOrEmpty()] + [ValidateScript( { + return Test-Path -PathType 'Container' -Path $_ -ErrorAction 'Ignore' + }, + ErrorMessage = "Invalid or non-existant path: '{0}'.")] + [Parameter(Mandatory = $true)] + [string] + $Destination, + + # Application name. + [ValidateNotNullOrEmpty()] + [Parameter(Mandatory = $true)] + [string] + $Name, + + # Application version. + [ValidateNotNullOrEmpty()] + [version] + $Version = '1.0.0.0', + + # Read version from internal\version\data\VERSION. + # Falls back on $Version parameter if file is not found. + # + # See internal\version\version.go or Set-VersionInfo.ps1 for more info. + [ValidateNotNullOrEmpty()] + [switch] + $UseVersionFile, + + # Processors architecture to target. + # Use all to generate for all supported architectures. + [ValidateSet('amd64', 'arm64', 'all')] + $Architecture = 'amd64', + + # Visual Studio installation path + [ValidateNotNullOrEmpty()] + [ValidateScript( { + return Test-Path -PathType 'Container' -Path $_ -ErrorAction 'Ignore' + }, + ErrorMessage = "Invalid or non-existant directory: '{0}'.")] + [string] + $VSPath +) + +$root = Split-Path $PSScriptRoot + +function run([string]$cmd) { + Write-Verbose "Running command: $cmd" + $r = & ${env:COMSPEC} /C $cmd 2>&1 + if ( $LASTEXITCODE -ne 0 ) { + Write-Host $r + Write-Error -ErrorAction 'Stop' "Command failed: $cmd" + } + $r +} + +function Get-PackageVersion { + [CmdletBinding()] + param ( + [string] + $file = 'internal\version\data\VERSION' + ) + Write-Verbose "Reading version from version file: $file" + + $vf = Join-Path -Resolve $root $file -ErrorAction 'Ignore' + if ( [string]::IsNullOrEmpty($vf) ) { + Write-Error "Version file $file does not exist" -ErrorAction 'Continue' + return + } + + $s = (Get-Content $vf -ErrorAction 'Ignore').Trim() + if ( [string]::IsNullOrWhiteSpace($s) ) { + Write-Error "Empty version file: ${vf}" -ErrorAction 'Continue' + return + } + + # remove "v" prefix + $s = $s.Trim() -replace '^v', '' + Write-Verbose "Read version from file `"${vf}`": $s" + try { + $v = [semver]$s + } catch { + Write-Error "Invalid version string: $s" -ErrorAction 'Continue' + return + } + [version]::new($v.Major, $v.Minor, $v.Patch, 0) +} + +$Destination = Resolve-Path $Destination -ErrorAction 'Stop' + +$manifestDir = New-Item -ItemType 'Directory' -Force -Path (Join-Path $env:TEMP 'manifest' "$Name-$(New-Guid)") -ErrorAction 'Stop' +$Manifest = Join-Path $manifestDir 'manifest.xml' -ErrorAction 'Stop' + +if ( $UseVersionFile ) { + $v = Get-PackageVersion -ErrorAction 'Continue' + if ( $null -ne $v ) { + # Fall back on default version if file is empty + $Version = $v + } + Write-Verbose "Using version: $Version" +} + +[xml]$m = @' + + + + + + + true + + + + + + + + +'@ + +$m.assembly.assemblyIdentity.SetAttribute('name', "Microsoft.ContainerPlatform.$Name") +$m.assembly.assemblyIdentity.SetAttribute('version', $Version) +if ( $Architecture -ne 'all' ) { + # valid values: x86, amd64, arm, arm64 + $m.assembly.assemblyIdentity.SetAttribute('processorArchitecture', $Architecture.ToLower()) +} + +$m.PreserveWhitespace = $false +$m.Save($Manifest) +Write-Verbose "Wrote manifest file: $Manifest" + +if ( [string]::IsNullOrEmpty($VSPath) ) { + $vswhere = Join-Path -Resolve ${env:ProgramFiles(x86)} 'Microsoft Visual Studio\Installer\vswhere.exe' -ErrorAction 'Stop' + $VSPath = run "`"$vswhere`" -prerelease -latest -property installationPath" +} else { + $VSPath = Resolve-Path $VSPath -ErrorAction 'Stop' +} +Write-Verbose "Using Visual Studio installation: $VSPath" + +$vsdevbat = Join-Path -Resolve $VSPath '\Common7\Tools\vsdevcmd.bat' -ErrorAction 'Ignore' +if ( [string]::IsNullOrEmpty($vsdevbat) ) { + Write-Error -ErrorAction 'Stop' "Missing 'vsdevcmd.bat' tool in valid Visual Studio SDK installation: $VSPath" +} +Write-Verbose "Visual Studio CMD batch file: $vsdevbat" +# surpress output line of "Parsing of manifest successful." +$null = run "cd /d ${manifestDir}&&`"${vsdevbat}`" -no_logo&&mt.exe -nologo -manifest $(Split-Path -Leaf $manifest) -validate_manifest" + +$rc = Join-Path $manifestDir 'resource.rc' -ErrorAction 'Stop' +$vstr = "$($Version.Major), $($Version.Minor), $($Version.Build), 0" + +# TODO: set VER_PRODUCT* fields with package release info +@" +#include + +#pragma code_page(65001) // UTF-8 + +#define VER_FILEDESCRIPTION_STR "Microsoft Container Platform $Name" +#define VER_FILEVERSION $vstr +#define VER_FILEVERSION_STR "$version" + +#define VER_PRODUCTNAME_STR "Microsoft Container Platform" +#define VER_PRODUCTVERSION $vstr +#define VER_PRODUCTVERSION_STR "$version" + +#define VER_INTERNALNAME_STR "${Name}.exe" +#define VER_ORIGINALFILENAME_STR "${Name}.exe" + +#define VER_COMPANYNAME_STR "Microsoft Corporation" + +#define VER_FILEFLAGSMASK VS_FFI_FILEFLAGSMASK +#define VER_FILEFLAGS 0 +#define VER_FILEOS VOS_NT_WINDOWS32 +#define VER_FILETYPE VFT_APP +#define VER_FILESUBTYPE VFT2_UNKNOWN + +#define MANIFEST_RESOURCE_ID 1 +MANIFEST_RESOURCE_ID RT_MANIFEST "manifest.xml" + +#include +"@ | Out-File -Encoding 'ascii' -FilePath $rc -ErrorAction 'Stop' + +run "cd /d ${manifestDir}&&`"${vsdevbat}`" -no_logo&&rc.exe /nologo $(Split-Path -Leaf $rc)" + +# Conveniently, the accepted processorArchitecture values match GOARCH values, +# but CVTRES needs its own constants (ARM, ARM64, ARM64EC, ARM64X, EBC, IA64, X64, X86) +foreach ( $p in @{ + 'amd64' = 'X64' + 'arm64' = 'ARM64' + }.GetEnumerator() ) { + $arch = $p.Key + if ( ($Architecture -ne $arch) -and ($Architecture -ne 'all') ) { + continue + } + + $syso = Join-Path $Destination "resource_windows_${arch}.syso" + Write-Verbose "Generating $arch resource file: $syso" + run "cd /d ${manifestDir}&&`"${vsdevbat}`" -no_logo&&CVTRES.exe /NOLOGO /MACHINE:$($p.Value) `"/OUT:${syso}`" resource.res" +} diff --git a/scripts/Set-VersionInfo.ps1 b/scripts/Set-VersionInfo.ps1 index a61cf5d6ff..45a29c612d 100644 --- a/scripts/Set-VersionInfo.ps1 +++ b/scripts/Set-VersionInfo.ps1 @@ -1,4 +1,4 @@ -# Example of who to set the version/git information in ./internal/version so +# Set the version/git information in ./internal/version so # that the binaries will report the appropriate information. $ErrorActionPreference = 'Continue' diff --git a/test/go.mod b/test/go.mod index d8cce74985..0006539432 100644 --- a/test/go.mod +++ b/test/go.mod @@ -2,9 +2,6 @@ module github.com/Microsoft/hcsshim/test go 1.25.0 -// create syso files for manifesting -tool github.com/josephspurrier/goversioninfo/cmd/goversioninfo - require ( github.com/Microsoft/go-winio v0.6.3-0.20251027160822-ad3df93bed29 github.com/Microsoft/hcsshim v0.14.0-rc.1 @@ -38,7 +35,6 @@ require ( github.com/Microsoft/didx509go v0.0.3 // indirect github.com/OneOfOne/xxhash v1.2.8 // indirect github.com/agnivade/levenshtein v1.2.0 // indirect - github.com/akavel/rsrc v0.10.2 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/cenkalti/backoff/v4 v4.3.0 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect @@ -72,7 +68,6 @@ require ( github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8 // indirect github.com/google/uuid v1.6.0 // indirect github.com/gorilla/mux v1.8.1 // indirect - github.com/josephspurrier/goversioninfo v1.5.0 // indirect github.com/klauspost/compress v1.18.5 // indirect github.com/lestrrat-go/backoff/v2 v2.0.8 // indirect github.com/lestrrat-go/blackmagic v1.0.2 // indirect diff --git a/test/go.sum b/test/go.sum index ac6ecbbe00..2228ba1ed0 100644 --- a/test/go.sum +++ b/test/go.sum @@ -14,8 +14,6 @@ github.com/OneOfOne/xxhash v1.2.8 h1:31czK/TI9sNkxIKfaUfGlU47BAxQ0ztGgd9vPyqimf8 github.com/OneOfOne/xxhash v1.2.8/go.mod h1:eZbhyaAYD41SGSSsnmcpxVoRiQ/MPUTjUdIIOT9Um7Q= github.com/agnivade/levenshtein v1.2.0 h1:U9L4IOT0Y3i0TIlUIDJ7rVUziKi/zPbrJGaFrtYH3SY= github.com/agnivade/levenshtein v1.2.0/go.mod h1:QVVI16kDrtSuwcpd0p1+xMC6Z/VfhtCyDIjcwga4/DU= -github.com/akavel/rsrc v0.10.2 h1:Zxm8V5eI1hW4gGaYsJQUhxpjkENuG91ki8B4zCrvEsw= -github.com/akavel/rsrc v0.10.2/go.mod h1:uLoCtb9J+EyAqh+26kdrTgmzRBFPGOolLWKpdxkKq+c= github.com/arbovm/levenshtein v0.0.0-20160628152529-48b4e1c0c4d0 h1:jfIu9sQUG6Ig+0+Ap1h4unLjW6YQJpKZVmUzxsD4E/Q= github.com/arbovm/levenshtein v0.0.0-20160628152529-48b4e1c0c4d0/go.mod h1:t2tdKJDJF9BV14lnkjHmOQgcvEKgtqs5a1N3LNdJhGE= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= @@ -166,8 +164,6 @@ github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= -github.com/josephspurrier/goversioninfo v1.5.0 h1:9TJtORoyf4YMoWSOo/cXFN9A/lB3PniJ91OxIH6e7Zg= -github.com/josephspurrier/goversioninfo v1.5.0/go.mod h1:6MoTvFZ6GKJkzcdLnU5T/RGYUbHQbKpYeNP0AgQLd2o= github.com/josharian/native v1.1.0 h1:uuaP0hAbW7Y4l0ZRQ6C9zfb7Mg1mbFKry/xzDAfmtLA= github.com/josharian/native v1.1.0/go.mod h1:7X/raswPFr05uY3HiLlYeyQntB6OO7E/d2Cu7qoaN2w= github.com/jsimonetti/rtnetlink/v2 v2.0.1 h1:xda7qaHDSVOsADNouv7ukSuicKZO7GgVUCXxpaIEIlM= diff --git a/test/pkg/manifest/manifest.go b/test/pkg/manifest/manifest.go index fb40921761..64ae11707f 100644 --- a/test/pkg/manifest/manifest.go +++ b/test/pkg/manifest/manifest.go @@ -3,4 +3,4 @@ // This package allows tests can include the .syso to manifest them to pick up the right Windows build package manifest -//go:generate go tool github.com/josephspurrier/goversioninfo/cmd/goversioninfo -platform-specific +//go:generate pwsh -Command "../../../scripts/New-ResourceObjectFile.ps1 -ErrorAction 'Stop' -Destination '.' -Name 'hcsshim-test' -UseVersionFile -Architecture 'all'" diff --git a/test/pkg/manifest/manifest.xml b/test/pkg/manifest/manifest.xml deleted file mode 100644 index 229e61e1fd..0000000000 --- a/test/pkg/manifest/manifest.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - hcsshim-test - - - - - - - diff --git a/test/pkg/manifest/resource_windows_386.syso b/test/pkg/manifest/resource_windows_386.syso deleted file mode 100644 index 497a64fa82608b252b579be01a7d115e029b90f3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 990 zcma)5%Wl&^6g_SuRn3Y;7c2*ht&r+ z6Iif-1$+L6KR}$Zv6>PVTzlre&OP^fY`?H982PaaG*-vzmAVY-XtP~0=hOT`ZDfb* zxW0|o$`0<)6u`}W>N9Gp4Y6u|?;r8~&Q_3h4SuMizIT59YM#C=ZuGRy0v%p$=1&L}4U2pgN+@KwB%4Bl zh|C#cyvdmdoLX#tBJ+Ow09?|V$2+z1IA|;XA z-GGOj6S!bjl0$PEN#>RjJh#sV0DpRwCSo0xTIJc;c6$R`L|KrBD!UxpuP;s<&lb9p zStye{i^leKr0waX>r1Vpbdg*O)@OQbugdI52g@jx+DTPV<~olnC&<$ysng!twM8m3 z6-T<7Z#J8B1;q~|9h9o5IK*TbXuVXaQxWU;H!}^EoQ15^LM5vDkM?)qW{{?3-BuPw zq5_h!ZB1^XM*IhkBi^Vi%-?C@4g{b7)^&yB`~}ymqR7iC3Qy0)EF9bKy=V|Wk?tdB z5icG)!#MJs#i1NILoW_T1L=c7A^ Pd)WME&9}N+e+$0>!_T{i diff --git a/test/pkg/manifest/resource_windows_amd64.syso b/test/pkg/manifest/resource_windows_amd64.syso deleted file mode 100644 index 05db0b5231ad618637a7ec296f91cc1c44213e31..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 990 zcma)5%Wl&^6g_UTX;v({U}-G2lf;k+r*hH?L8WYHMN3$si66~Ke#zs6RtTvp)_ek= zz=8!V*z-610pg5})s(Q{+B5fc?zz`vJN#h5$d3-tSY4}M>N2RK&346{PxA}4kv*>C z`ZiuGd$>o_25#^I@T;Aa1%v-c#3!zUW@uW#SK8mU`~z#m z=mO_>!~Hp4(wgHGFX+#?pU^h)z5DZ5^Ym?TqmSw=(B;);{)AA`u*g@TghGZ(vMD5p z$ebZY&OFb6m?1`7lUhIJ4tUsS{EU@3LaY&xWx>i4njAUnfel>riEbA|c*bQBDT&a@Rc9Xpko ziX&Yuwwuj*HpLGk9h9o5IK*rfXuVRYsEG9k+nEMS&O%mdsS;KFNBcW)Gf302ZYzr- zQ31)=wk9`GBmM&+?AIy_^S9b|hc=)8)^%+m{(|duQRHP6g{SBCJe)f3yl5Cdk?te0 zjF*qaD2_a_oXD{ld2u)%N_Q+L^1U;-rSS(l!}xK*9Re}Qp2 N*#2kDx7w+{h2J5yyc_@k diff --git a/test/pkg/manifest/resource_windows_arm.syso b/test/pkg/manifest/resource_windows_arm.syso deleted file mode 100644 index c1c2165f3a58ae8357eea075d69fc4f1ac25733d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 990 zcma)5!EVz)5FNLIcfyqZ7!NBp3(6GUBuU+ttka`+EGe1sl0L&GEb0{`pQ z{?HpDx}bAj``(-#R~kHBa9bH+EKMi8}bTnLi<_;CSGxs3b+2 zF2SZKBMD|rDH-H(2EYtx2p!krJ;n@6oX}f%91QN4C;wC6i^T7RuQ6S zP!C7}r9-I6~*u1w1 ze3lEXQfaHjcC%@hL83(3xKu@jA*QR?+Lg+A1#Hyc&NNtX7NSy1m8t4K+TVe@L7J9z zTTv95ib009HMxsAi5_syUMroLx0VG1hUdTC28{E+;C5XUrmSRgdd}v_#D5pcLHa}l zkN7fOKIX$zhI}~|BR&k%WHb=LNQ}jMzkf>;^>>De`gdl>q4(QUpLX5LgWS}syNB); QIN77^JL|sH{rX$@4U*ft^#A|> diff --git a/test/pkg/manifest/resource_windows_arm64.syso b/test/pkg/manifest/resource_windows_arm64.syso deleted file mode 100644 index eb5df81f125b73d01ce0074d119e25d1a0907289..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 990 zcma)5!EVz)5FNL3bAnF?YYA5B9!+!wcBlNHt8XnPC_}{kn zhu#p;1)b9ytk3Bsyg8lH3+(4uPvATG-ud~fdHS}vv9mf$)WNUK{0UJ7#{*wQB`MN$ z2{uI;Nib_l$smt20A@f#=(x5|u@Z%JfcP0I4JEXu7%U4^mSn+UP*1d>fO>+Oe4VDG7`@1vjb2xyUH`Rk)>5ePyC=a@R`)HNtC{v_^&Qb zc<3`*37v?{XgTq(rS)giZX~Rg`7*m^sMmJluS$z9Y*^ni2rTIs~RwJaDgJpb)BV4VL2x9g%XWhIl-b2d*V{<}~P(kCK# z#Fy#vF(0Nf -Mateusz Czapliński -Quentin Renard -shnmng -Thomas Combeléran diff --git a/vendor/github.com/akavel/rsrc/LICENSE.txt b/vendor/github.com/akavel/rsrc/LICENSE.txt deleted file mode 100644 index 5c1511ec15..0000000000 --- a/vendor/github.com/akavel/rsrc/LICENSE.txt +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2013-2017 The rsrc Authors. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/github.com/akavel/rsrc/binutil/plain.go b/vendor/github.com/akavel/rsrc/binutil/plain.go deleted file mode 100644 index ddf5238b94..0000000000 --- a/vendor/github.com/akavel/rsrc/binutil/plain.go +++ /dev/null @@ -1,13 +0,0 @@ -package binutil - -import ( - "reflect" -) - -func Plain(kind reflect.Kind) bool { - switch kind { - case reflect.Bool, reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr, reflect.Float32, reflect.Float64, reflect.Complex64, reflect.Complex128: - return true - } - return false -} diff --git a/vendor/github.com/akavel/rsrc/binutil/sizedfile.go b/vendor/github.com/akavel/rsrc/binutil/sizedfile.go deleted file mode 100644 index 3a6606fd85..0000000000 --- a/vendor/github.com/akavel/rsrc/binutil/sizedfile.go +++ /dev/null @@ -1,35 +0,0 @@ -package binutil - -import ( - "io" - "os" -) - -type SizedReader interface { - io.Reader - Size() int64 -} - -type SizedFile struct { - f *os.File - s *io.SectionReader // helper, for Size() -} - -func (r *SizedFile) Read(p []byte) (n int, err error) { return r.s.Read(p) } -func (r *SizedFile) Size() int64 { return r.s.Size() } -func (r *SizedFile) Close() error { return r.f.Close() } - -func SizedOpen(filename string) (*SizedFile, error) { - f, err := os.Open(filename) - if err != nil { - return nil, err - } - info, err := f.Stat() - if err != nil { - return nil, err - } - return &SizedFile{ - f: f, - s: io.NewSectionReader(f, 0, info.Size()), - }, nil -} diff --git a/vendor/github.com/akavel/rsrc/binutil/walk.go b/vendor/github.com/akavel/rsrc/binutil/walk.go deleted file mode 100644 index 4aa4ad30e8..0000000000 --- a/vendor/github.com/akavel/rsrc/binutil/walk.go +++ /dev/null @@ -1,63 +0,0 @@ -package binutil - -import ( - "errors" - "fmt" - "path" - "reflect" -) - -var ( - WALK_SKIP = errors.New("") -) - -type Walker func(v reflect.Value, path string) error - -func Walk(value interface{}, walker Walker) error { - err := walk(reflect.ValueOf(value), "/", walker) - if err == WALK_SKIP { - err = nil - } - return err -} - -func stopping(err error) bool { - return err != nil && err != WALK_SKIP -} - -func walk(v reflect.Value, spath string, walker Walker) error { - err := walker(v, spath) - if err != nil { - return err - } - v = reflect.Indirect(v) - switch v.Kind() { - case reflect.Slice, reflect.Array: - for i := 0; i < v.Len(); i++ { - err = walk(v.Index(i), spath+fmt.Sprintf("[%d]", i), walker) - if stopping(err) { - return err - } - } - case reflect.Interface: - err = walk(v.Elem(), spath, walker) - if stopping(err) { - return err - } - case reflect.Struct: - //t := v.Type() - for i := 0; i < v.NumField(); i++ { - //f := t.Field(i) //TODO: handle unexported fields - vv := v.Field(i) - err = walk(vv, path.Join(spath, v.Type().Field(i).Name), walker) - if stopping(err) { - return err - } - } - default: - // FIXME: handle other special cases too - // String - return nil - } - return nil -} diff --git a/vendor/github.com/akavel/rsrc/binutil/writer.go b/vendor/github.com/akavel/rsrc/binutil/writer.go deleted file mode 100644 index cd2ef97818..0000000000 --- a/vendor/github.com/akavel/rsrc/binutil/writer.go +++ /dev/null @@ -1,33 +0,0 @@ -package binutil - -import ( - "encoding/binary" - "io" - "reflect" -) - -type Writer struct { - W io.Writer - Offset uint32 //FIXME: int64? - Err error -} - -func (w *Writer) WriteLE(v interface{}) { - if w.Err != nil { - return - } - w.Err = binary.Write(w.W, binary.LittleEndian, v) - if w.Err != nil { - return - } - w.Offset += uint32(reflect.TypeOf(v).Size()) -} - -func (w *Writer) WriteFromSized(r SizedReader) { - if w.Err != nil { - return - } - var n int64 - n, w.Err = io.CopyN(w.W, r, r.Size()) - w.Offset += uint32(n) -} diff --git a/vendor/github.com/akavel/rsrc/coff/coff.go b/vendor/github.com/akavel/rsrc/coff/coff.go deleted file mode 100644 index 3c6d5f4b93..0000000000 --- a/vendor/github.com/akavel/rsrc/coff/coff.go +++ /dev/null @@ -1,363 +0,0 @@ -package coff - -import ( - "debug/pe" - "encoding/binary" - "errors" - "io" - "reflect" - "regexp" - "sort" - "strconv" - "strings" - - "github.com/akavel/rsrc/binutil" -) - -type Dir struct { // struct IMAGE_RESOURCE_DIRECTORY - Characteristics uint32 - TimeDateStamp uint32 - MajorVersion uint16 - MinorVersion uint16 - NumberOfNamedEntries uint16 - NumberOfIdEntries uint16 - DirEntries - Dirs -} - -type DirEntries []DirEntry -type Dirs []Dir - -type DirEntry struct { // struct IMAGE_RESOURCE_DIRECTORY_ENTRY - NameOrId uint32 - OffsetToData uint32 -} - -type DataEntry struct { // struct IMAGE_RESOURCE_DATA_ENTRY - OffsetToData uint32 - Size1 uint32 - CodePage uint32 //FIXME: what value here? for now just using 0 - Reserved uint32 -} - -type RelocationEntry struct { - RVA uint32 // "offset within the Section's raw data where the address starts." - SymbolIndex uint32 // "(zero based) index in the Symbol table to which the reference refers." - Type uint16 -} - -// Values reverse-engineered from windres output; names from teh Internets. -// Teh googlies Internets don't seem to have much to say about the AMD64 one, -// unfortunately :/ but it works... -const ( - _IMAGE_REL_AMD64_ADDR32NB = 0x03 - _IMAGE_REL_I386_DIR32NB = 0x07 - _IMAGE_REL_ARM64_ADDR32NB = 0x02 - _IMAGE_REL_ARM_ADDR32NB = 0x02 -) - -type Auxiliary [18]byte - -type Symbol struct { - Name [8]byte - Value uint32 - SectionNumber uint16 - Type uint16 - StorageClass uint8 - AuxiliaryCount uint8 - Auxiliaries []Auxiliary -} - -type StringsHeader struct { - Length uint32 -} - -const ( - MASK_SUBDIRECTORY = 1 << 31 - - RT_ICON = 3 - RT_GROUP_ICON = 3 + 11 - RT_MANIFEST = 24 -) - -// http://www.delorie.com/djgpp/doc/coff/symtab.html -const ( - DT_PTR = 1 - T_UCHAR = 12 -) - -var ( - STRING_RSRC = [8]byte{'.', 'r', 's', 'r', 'c', 0, 0, 0} - - LANG_ENTRY = DirEntry{NameOrId: 0x0409} //FIXME: language; what value should be here? -) - -type PaddedData struct { - Data Sizer - Padding []byte -} - -type Sizer interface { - Size() int64 //NOTE: must not exceed limits of uint32, or behavior is undefined -} - -type Coff struct { - pe.FileHeader - pe.SectionHeader32 - - *Dir - DataEntries []DataEntry - Data []PaddedData - - Relocations []RelocationEntry - Symbols []Symbol - StringsHeader - Strings []Sizer -} - -// NOTE: must be called immediately after NewRSRC, before any other -// functions. -func (coff *Coff) Arch(arch string) error { - switch arch { - case "386": - coff.Machine = pe.IMAGE_FILE_MACHINE_I386 - case "amd64": - // Sources: - // https://github.com/golang/go/blob/0e23ca41d99c82d301badf1b762888e2c69e6c57/src/debug/pe/pe.go#L116 - // https://github.com/yasm/yasm/blob/7160679eee91323db98b0974596c7221eeff772c/modules/objfmts/coff/coff-objfmt.c#L38 - // FIXME: currently experimental -- not sure if something more doesn't need to be changed - coff.Machine = pe.IMAGE_FILE_MACHINE_AMD64 - case "arm": - // see - // https://github.com/golang/go/blob/f3424ceff2fa48615ed98580f337ab044925c940/src/cmd/link/internal/ld/pe.go#L736 - coff.Machine = pe.IMAGE_FILE_MACHINE_ARMNT - case "arm64": - // Waiting https://github.com/golang/go/issues/36439 - coff.Machine = pe.IMAGE_FILE_MACHINE_ARM64 - default: - return errors.New("coff: unknown architecture: " + arch) - } - return nil -} - -// addSymbol appends a symbol to Coff.Symbols and to Coff.Strings. -//NOTE: symbol s must be probably >8 characters long -//NOTE: symbol s should not contain embedded zeroes -func (coff *Coff) addSymbol(s string) { - coff.FileHeader.NumberOfSymbols++ - - buf := strings.NewReader(s + "\000") // ASCIIZ - r := io.NewSectionReader(buf, 0, int64(len(s)+1)) - coff.Strings = append(coff.Strings, r) - - coff.StringsHeader.Length += uint32(r.Size()) - - coff.Symbols = append(coff.Symbols, Symbol{ - //Name: // will be filled in Freeze - //Value: // as above - SectionNumber: 1, - Type: 0, // why 0??? // DT_PTR<<4 | T_UCHAR, // unsigned char* // (?) or use void* ? T_VOID=1 - StorageClass: 2, // 2=C_EXT, or 5=C_EXTDEF ? - AuxiliaryCount: 0, - }) -} - -func NewRSRC() *Coff { - return &Coff{ - pe.FileHeader{ - Machine: pe.IMAGE_FILE_MACHINE_I386, - NumberOfSections: 1, // .rsrc - TimeDateStamp: 0, // was also 0 in sample data from MinGW's windres.exe - NumberOfSymbols: 1, - SizeOfOptionalHeader: 0, - Characteristics: 0x0104, //FIXME: copied from windres.exe output, find out what should be here and why - }, - pe.SectionHeader32{ - Name: STRING_RSRC, - Characteristics: 0x40000040, // "INITIALIZED_DATA MEM_READ" ? - }, - - // "directory hierarchy" of .rsrc section: top level goes resource type, then id/name, then language - &Dir{}, - - []DataEntry{}, - []PaddedData{}, - - []RelocationEntry{}, - - []Symbol{Symbol{ - Name: STRING_RSRC, - Value: 0, - SectionNumber: 1, - Type: 0, // FIXME: wtf? - StorageClass: 3, // FIXME: is it ok? and uint8? and what does the value mean? - AuxiliaryCount: 0, // FIXME: wtf? - }}, - - StringsHeader{ - Length: uint32(binary.Size(StringsHeader{})), // empty strings table -- but we must still show size of the table's header... - }, - []Sizer{}, - } -} - -//NOTE: function assumes that 'id' is increasing on each entry -//NOTE: only usable for Coff created using NewRSRC -func (coff *Coff) AddResource(kind uint32, id uint16, data Sizer) { - re := RelocationEntry{ - // "(zero based) index in the Symbol table to which the - // reference refers. Once you have loaded the COFF file into - // memory and know where each symbol is, you find the new - // updated address for the given symbol and update the - // reference accordingly." - SymbolIndex: 0, - } - switch coff.Machine { - case pe.IMAGE_FILE_MACHINE_I386: - re.Type = _IMAGE_REL_I386_DIR32NB - case pe.IMAGE_FILE_MACHINE_AMD64: - re.Type = _IMAGE_REL_AMD64_ADDR32NB - case pe.IMAGE_FILE_MACHINE_ARMNT: - re.Type = _IMAGE_REL_ARM_ADDR32NB - case pe.IMAGE_FILE_MACHINE_ARM64: - re.Type = _IMAGE_REL_ARM64_ADDR32NB - } - coff.Relocations = append(coff.Relocations, re) - coff.SectionHeader32.NumberOfRelocations++ - - // find top level entry, inserting new if necessary at correct sorted position - entries0 := coff.Dir.DirEntries - dirs0 := coff.Dir.Dirs - i0 := sort.Search(len(entries0), func(i int) bool { - return entries0[i].NameOrId >= kind - }) - if i0 >= len(entries0) || entries0[i0].NameOrId != kind { - // inserting new entry & dir - entries0 = append(entries0[:i0], append([]DirEntry{{NameOrId: kind}}, entries0[i0:]...)...) - dirs0 = append(dirs0[:i0], append([]Dir{{}}, dirs0[i0:]...)...) - coff.Dir.NumberOfIdEntries++ - } - coff.Dir.DirEntries = entries0 - coff.Dir.Dirs = dirs0 - - // for second level, assume ID is always increasing, so we don't have to sort - dirs0[i0].DirEntries = append(dirs0[i0].DirEntries, DirEntry{NameOrId: uint32(id)}) - dirs0[i0].Dirs = append(dirs0[i0].Dirs, Dir{ - NumberOfIdEntries: 1, - DirEntries: DirEntries{LANG_ENTRY}, - }) - dirs0[i0].NumberOfIdEntries++ - - // calculate preceding DirEntry leaves, to find new index in Data & DataEntries - n := 0 - for _, dir0 := range dirs0[:i0+1] { - n += len(dir0.DirEntries) //NOTE: assuming 1 language here; TODO: dwell deeper if more langs added - } - n-- - - // insert new data in correct place - coff.DataEntries = append(coff.DataEntries[:n], append([]DataEntry{{Size1: uint32(data.Size())}}, coff.DataEntries[n:]...)...) - coff.Data = append(coff.Data[:n], append([]PaddedData{pad(data)}, coff.Data[n:]...)...) -} - -func pad(data Sizer) PaddedData { - return PaddedData{ - Data: data, - Padding: make([]byte, -data.Size()&7), - } -} - -// Freeze fills in some important offsets in resulting file. -func (coff *Coff) Freeze() { - switch coff.SectionHeader32.Name { - case STRING_RSRC: - coff.freezeRSRC() - } -} - -func (coff *Coff) freezeCommon1(path string, offset, diroff uint32) (newdiroff uint32) { - switch path { - case "/Dir": - coff.SectionHeader32.PointerToRawData = offset - diroff = offset - case "/Relocations": - coff.SectionHeader32.PointerToRelocations = offset - coff.SectionHeader32.SizeOfRawData = offset - diroff - case "/Symbols": - coff.FileHeader.PointerToSymbolTable = offset - } - return diroff -} - -func freezeCommon2(v reflect.Value, offset *uint32) error { - if binutil.Plain(v.Kind()) { - *offset += uint32(binary.Size(v.Interface())) // TODO: change to v.Type().Size() ? - return nil - } - vv, ok := v.Interface().(Sizer) - if ok { - *offset += uint32(vv.Size()) - return binutil.WALK_SKIP - } - return nil -} - -func (coff *Coff) freezeRSRC() { - leafwalker := make(chan *DirEntry) - go func() { - for _, dir1 := range coff.Dir.Dirs { // resource type - for _, dir2 := range dir1.Dirs { // resource ID - for i := range dir2.DirEntries { // resource lang - leafwalker <- &dir2.DirEntries[i] - } - } - } - }() - - var offset, diroff uint32 - binutil.Walk(coff, func(v reflect.Value, path string) error { - diroff = coff.freezeCommon1(path, offset, diroff) - - RE := regexp.MustCompile - const N = `\[(\d+)\]` - m := matcher{} - switch { - case m.Find(path, RE("^/Dir/Dirs"+N+"$")): - coff.Dir.DirEntries[m[0]].OffsetToData = MASK_SUBDIRECTORY | (offset - diroff) - case m.Find(path, RE("^/Dir/Dirs"+N+"/Dirs"+N+"$")): - coff.Dir.Dirs[m[0]].DirEntries[m[1]].OffsetToData = MASK_SUBDIRECTORY | (offset - diroff) - case m.Find(path, RE("^/DataEntries"+N+"$")): - direntry := <-leafwalker - direntry.OffsetToData = offset - diroff - case m.Find(path, RE("^/DataEntries"+N+"/OffsetToData$")): - coff.Relocations[m[0]].RVA = offset - diroff - case m.Find(path, RE("^/Data"+N+"$")): - coff.DataEntries[m[0]].OffsetToData = offset - diroff - } - - return freezeCommon2(v, &offset) - }) -} - -func mustAtoi(s string) int { - i, err := strconv.Atoi(s) - if err != nil { - panic(err) - } - return i -} - -type matcher []int - -func (m *matcher) Find(s string, re *regexp.Regexp) bool { - subs := re.FindStringSubmatch(s) - if subs == nil { - return false - } - - *m = (*m)[:0] - for i := 1; i < len(subs); i++ { - *m = append(*m, mustAtoi(subs[i])) - } - return true -} diff --git a/vendor/github.com/akavel/rsrc/ico/ico.go b/vendor/github.com/akavel/rsrc/ico/ico.go deleted file mode 100644 index 0d419b1272..0000000000 --- a/vendor/github.com/akavel/rsrc/ico/ico.go +++ /dev/null @@ -1,214 +0,0 @@ -// Package ico describes Windows ICO file format. -package ico - -// ICO: http://msdn.microsoft.com/en-us/library/ms997538.aspx -// BMP/DIB: http://msdn.microsoft.com/en-us/library/windows/desktop/dd183562%28v=vs.85%29.aspx - -import ( - "bytes" - "encoding/binary" - "fmt" - "image" - "image/color" - "io" - "io/ioutil" - "sort" -) - -const ( - BI_RGB = 0 -) - -type ICONDIR struct { - Reserved uint16 // must be 0 - Type uint16 // Resource Type (1 for icons) - Count uint16 // How many images? -} - -type IconDirEntryCommon struct { - Width byte // Width, in pixels, of the image - Height byte // Height, in pixels, of the image - ColorCount byte // Number of colors in image (0 if >=8bpp) - Reserved byte // Reserved (must be 0) - Planes uint16 // Color Planes - BitCount uint16 // Bits per pixel - BytesInRes uint32 // How many bytes in this resource? -} - -type ICONDIRENTRY struct { - IconDirEntryCommon - ImageOffset uint32 // Where in the file is this image? [from beginning of file] -} - -type BITMAPINFOHEADER struct { - Size uint32 - Width int32 - Height int32 // NOTE: "represents the combined height of the XOR and AND masks. Remember to divide this number by two before using it to perform calculations for either of the XOR or AND masks." - Planes uint16 // [BMP/DIB]: "is always 1" - BitCount uint16 - Compression uint32 // for ico = 0 - SizeImage uint32 - XPelsPerMeter int32 // for ico = 0 - YPelsPerMeter int32 // for ico = 0 - ClrUsed uint32 // for ico = 0 - ClrImportant uint32 // for ico = 0 -} - -type RGBQUAD struct { - Blue byte - Green byte - Red byte - Reserved byte // must be 0 -} - -func skip(r io.Reader, n int64) error { - _, err := io.CopyN(ioutil.Discard, r, n) - return err -} - -type icoOffset struct { - n int - offset uint32 -} - -type rawico struct { - icoinfo ICONDIRENTRY - bmpinfo *BITMAPINFOHEADER - idx int - data []byte -} - -type byOffsets []rawico - -func (o byOffsets) Len() int { return len(o) } -func (o byOffsets) Less(i, j int) bool { return o[i].icoinfo.ImageOffset < o[j].icoinfo.ImageOffset } -func (o byOffsets) Swap(i, j int) { - tmp := o[i] - o[i] = o[j] - o[j] = tmp -} - -type ICO struct { - image.Image -} - -func DecodeHeaders(r io.Reader) ([]ICONDIRENTRY, error) { - var hdr ICONDIR - err := binary.Read(r, binary.LittleEndian, &hdr) - if err != nil { - return nil, err - } - if hdr.Reserved != 0 || hdr.Type != 1 { - return nil, fmt.Errorf("bad magic number") - } - - entries := make([]ICONDIRENTRY, hdr.Count) - for i := 0; i < len(entries); i++ { - err = binary.Read(r, binary.LittleEndian, &entries[i]) - if err != nil { - return nil, err - } - } - return entries, nil -} - -// NOTE: won't succeed on files with overlapping offsets -func unused_decodeAll(r io.Reader) ([]*ICO, error) { - var hdr ICONDIR - err := binary.Read(r, binary.LittleEndian, &hdr) - if err != nil { - return nil, err - } - if hdr.Reserved != 0 || hdr.Type != 1 { - return nil, fmt.Errorf("bad magic number") - } - - raws := make([]rawico, hdr.Count) - for i := 0; i < len(raws); i++ { - err = binary.Read(r, binary.LittleEndian, &raws[i].icoinfo) - if err != nil { - return nil, err - } - raws[i].idx = i - } - - sort.Sort(byOffsets(raws)) - - offset := uint32(binary.Size(&hdr) + len(raws)*binary.Size(ICONDIRENTRY{})) - for i := 0; i < len(raws); i++ { - err = skip(r, int64(raws[i].icoinfo.ImageOffset-offset)) - if err != nil { - return nil, err - } - offset = raws[i].icoinfo.ImageOffset - - raws[i].bmpinfo = &BITMAPINFOHEADER{} - err = binary.Read(r, binary.LittleEndian, raws[i].bmpinfo) - if err != nil { - return nil, err - } - - err = skip(r, int64(raws[i].bmpinfo.Size-uint32(binary.Size(BITMAPINFOHEADER{})))) - if err != nil { - return nil, err - } - raws[i].data = make([]byte, raws[i].icoinfo.BytesInRes-raws[i].bmpinfo.Size) - _, err = io.ReadFull(r, raws[i].data) - if err != nil { - return nil, err - } - } - - icos := make([]*ICO, len(raws)) - for i := 0; i < len(raws); i++ { - fmt.Println(i) - icos[raws[i].idx], err = decode(raws[i].bmpinfo, &raws[i].icoinfo, raws[i].data) - if err != nil { - return nil, err - } - } - return icos, nil -} - -func decode(info *BITMAPINFOHEADER, icoinfo *ICONDIRENTRY, data []byte) (*ICO, error) { - if info.Compression != BI_RGB { - return nil, fmt.Errorf("ICO compression not supported (got %d)", info.Compression) - } - - //if info.ClrUsed!=0 { - // panic(info.ClrUsed) - //} - - r := bytes.NewBuffer(data) - - bottomup := info.Height > 0 - if !bottomup { - info.Height = -info.Height - } - - switch info.BitCount { - case 8: - ncol := int(icoinfo.ColorCount) - if ncol == 0 { - ncol = 256 - } - - pal := make(color.Palette, ncol) - for i := 0; i < ncol; i++ { - var rgb RGBQUAD - err := binary.Read(r, binary.LittleEndian, &rgb) - if err != nil { - return nil, err - } - pal[i] = color.NRGBA{R: rgb.Red, G: rgb.Green, B: rgb.Blue, A: 0xff} //FIXME: is Alpha ok 0xff? - } - fmt.Println(pal) - - fmt.Println(info.SizeImage, len(data)-binary.Size(RGBQUAD{})*len(pal), info.Width, info.Height) - - default: - return nil, fmt.Errorf("unsupported ICO bit depth (BitCount) %d", info.BitCount) - } - - return nil, nil -} diff --git a/vendor/github.com/josephspurrier/goversioninfo/.gitattributes b/vendor/github.com/josephspurrier/goversioninfo/.gitattributes deleted file mode 100644 index 9f224172fc..0000000000 --- a/vendor/github.com/josephspurrier/goversioninfo/.gitattributes +++ /dev/null @@ -1,8 +0,0 @@ -*.sh text eol=lf -*.hex binary -*.rc text eol=crlf -*.manifest text eol=crlf -*.ico binary -testdata/go/*.go text eol=lf -go.mod text eol=lf -go.sum text eol=lf diff --git a/vendor/github.com/josephspurrier/goversioninfo/.gitignore b/vendor/github.com/josephspurrier/goversioninfo/.gitignore deleted file mode 100644 index b83ed98b82..0000000000 --- a/vendor/github.com/josephspurrier/goversioninfo/.gitignore +++ /dev/null @@ -1,19 +0,0 @@ -# IDE Settings -.vscode/ - -# Folders -vendor/ - -# Files -cmd/goversioninfo/goversioninfo -*.exe -*.syso -versioninfo.go -/bin - -# OS Files -.DS_Store -thumbs.db - -# Environment Files -.envrc \ No newline at end of file diff --git a/vendor/github.com/josephspurrier/goversioninfo/LICENSE b/vendor/github.com/josephspurrier/goversioninfo/LICENSE deleted file mode 100644 index 85f6e7e913..0000000000 --- a/vendor/github.com/josephspurrier/goversioninfo/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2016 Joseph Spurrier - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/vendor/github.com/josephspurrier/goversioninfo/Makefile b/vendor/github.com/josephspurrier/goversioninfo/Makefile deleted file mode 100644 index bbaa6729e2..0000000000 --- a/vendor/github.com/josephspurrier/goversioninfo/Makefile +++ /dev/null @@ -1,26 +0,0 @@ -# This Makefile is an easy way to run common operations. -# Execute commands this: -# * make test-go -# * make test-integration -# -# Tip: Each command is run on its own line so you can't CD unless you -# connect commands together using operators. See examples: -# A; B # Run A and then B, regardless of success of A -# A && B # Run B if and only if A succeeded -# A || B # Run B if and only if A failed -# A & # Run A in background. -# Source: https://askubuntu.com/a/539293 -# -# Tip: Use $(shell app param) syntax when expanding a shell return value. - -.PHONY: test-go -test-go: - # Run the Go tests. - go test ./... - -.PHONY: test-integration -test-integration: - # Build the application. - mkdir -p bin && go build -o bin/goversioninfo cmd/goversioninfo/main.go - # Test the application. - PATH="${PATH}:$(shell pwd)/bin" ./testdata/bash/build.sh \ No newline at end of file diff --git a/vendor/github.com/josephspurrier/goversioninfo/README.md b/vendor/github.com/josephspurrier/goversioninfo/README.md deleted file mode 100644 index 82407168c3..0000000000 --- a/vendor/github.com/josephspurrier/goversioninfo/README.md +++ /dev/null @@ -1,127 +0,0 @@ -GoVersionInfo -========== - -[![Go Report Card](https://goreportcard.com/badge/github.com/josephspurrier/goversioninfo)](https://goreportcard.com/report/github.com/josephspurrier/goversioninfo) [![Unit Tests](https://github.com/josephspurrier/goversioninfo/actions/workflows/unit-tests.yml/badge.svg)](https://github.com/josephspurrier/goversioninfo/actions/workflows/unit-tests.yml) [![Coverage Status](https://coveralls.io/repos/josephspurrier/goversioninfo/badge.svg)](https://coveralls.io/r/josephspurrier/goversioninfo) [![GoDoc](https://godoc.org/github.com/josephspurrier/goversioninfo?status.svg)](https://godoc.org/github.com/josephspurrier/goversioninfo) - -Microsoft Windows File Properties/Version Info and Icon Resource Generator for the Go Language - -Package creates a syso file which contains Microsoft Windows Version Information and an optional icon. When you run "go build", Go will embed the version information and an optional icon and an optional manifest in the executable. Go will automatically use the syso file if it's in the same directory as the main() function. - -Example of the file properties you can set using this package: - -![Image of File Properties](https://cloud.githubusercontent.com/assets/2394539/12073634/0b32cb04-b0f6-11e5-9d8e-f9923ca554cf.jpg) - -## Usage - -To install, run the following command: -~~~ -go get github.com/josephspurrier/goversioninfo/cmd/goversioninfo -~~~ - -Copy testdata/resource/versioninfo.json into your working directory and then modify the file with your own settings. - -Add a similar text to the top of your Go source code (-icon and -manifest are optional, but can also be specified in the versioninfo.json file): -~~~ go -//go:generate goversioninfo -icon=testdata/resource/icon.ico -manifest=testdata/resource/goversioninfo.exe.manifest -~~~ - -Run the Go commands in this order so goversioninfo will create a file called resource.syso in the same directory as the Go source code. -~~~ -go generate -go build -~~~ - -## Command-Line Flags - -Complete list of the flags for goversioninfo: - -~~~ - -charset=0: charset ID - -comment="": StringFileInfo.Comments - -company="": StringFileInfo.CompanyName - -copyright="": StringFileInfo.LegalCopyright - -description="": StringFileInfo.FileDescription - -example=false: dump out an example versioninfo.json to stdout - -file-version="": StringFileInfo.FileVersion - -icon="": icon file name(s), separated by commas - -internal-name="": StringFileInfo.InternalName - -manifest="": manifest file name - -skip-versioninfo=false: skip version info reading on true, allows setting just icon - -o="resource.syso": output file name - -gofile="": Go output file name (optional) - generates a Go file to access version information internally - -gofilepackage="main": Go output package name (optional, requires parameter: 'gofile') - -platform-specific=false: output i386 and amd64 named resource.syso, ignores -o - -original-name="": StringFileInfo.OriginalFilename - -private-build="": StringFileInfo.PrivateBuild - -product-name="": StringFileInfo.ProductName - -product-version="": StringFileInfo.ProductVersion - -special-build="": StringFileInfo.SpecialBuild - -trademark="": StringFileInfo.LegalTrademarks - -translation=0: translation ID - -64:false: generate 64-bit binaries on true - -arm:false: generate ARM binaries on true - -ver-major=-1: FileVersion.Major - -ver-minor=-1: FileVersion.Minor - -ver-patch=-1: FileVersion.Patch - -ver-build=-1: FileVersion.Build - -product-ver-major=-1: ProductVersion.Major - -product-ver-minor=-1: ProductVersion.Minor - -product-ver-patch=-1: ProductVersion.Patch - -product-ver-build=-1: ProductVersion.Build -~~~ - -You can look over the Microsoft Resource Information: [VERSIONINFO resource](https://msdn.microsoft.com/en-us/library/windows/desktop/aa381058(v=vs.85).aspx) - -You can look through the Microsoft Version Information structures: [Version Information Structures](https://msdn.microsoft.com/en-us/library/windows/desktop/ff468916(v=vs.85).aspx) - -## PowerShell Differences - -In PowerShell, the version components are named differently than the fields in -the versioninfo.json file: - -``` -PowerShell: versioninfo.json: ------------ ----------------- -FileMajorPart = FileVersion.Major -FileMinorPart = FileVersion.Minor -FileBuildPart = FileVersion.Patch -FilePrivatePart = FileVersion.Build -ProductMajorPart = ProductVersion.Major -ProductMinorPart = ProductVersion.Minor -ProductBuildPart = ProductVersion.Patch -ProductPrivatePart = ProductVersion.Build - -``` - -If you find any other differences, let me know. - -## Alternatives to this Tool - -You can also use [windres](https://sourceware.org/binutils/docs/binutils/windres.html) to create the syso file. The windres executable is available in either [MinGW](http://www.mingw.org/) or [tdm-gcc](http://tdm-gcc.tdragon.net/). - -Below is a sample batch file you can use to create a .syso file from a .rc file. There are sample .rc files in the testdata/rc folder. - -~~~ -@ECHO OFF - -SET PATH=C:\TDM-GCC-64\bin;%PATH% -REM SET PATH=C:\mingw64\bin;%PATH% - -windres -i testdata/rc/versioninfo.rc -O coff -o versioninfo.syso - -PAUSE -~~~ - -The information on how to create a .rc file is available [here](https://msdn.microsoft.com/en-us/library/windows/desktop/aa381043(v=vs.85).aspx). You can use the testdata/rc/versioninfo.rc file to create a .syso file that contains version info, icon, and manifest. - -## Issues - -The majority of the code for the creation of the syso file is from this package: [https://github.com/akavel/rsrc](https://github.com/akavel/rsrc) - -There is an [issue](https://github.com/akavel/rsrc/issues/12) with adding the icon resource that prevents your application from being compressed or modified with a resource editor. Please use with caution. - -## Major Contributions - -Thanks to [Tamás Gulácsi](https://github.com/tgulacsi) for his superb code additions, refactoring, and optimization to make this a solid package. - -Thanks to [Mateusz Czaplinski](https://github.com/akavel/rsrc) for his embedded binary resource package with icon and manifest functionality. diff --git a/vendor/github.com/josephspurrier/goversioninfo/cmd/goversioninfo/main.go b/vendor/github.com/josephspurrier/goversioninfo/cmd/goversioninfo/main.go deleted file mode 100644 index 54fc8a9ba6..0000000000 --- a/vendor/github.com/josephspurrier/goversioninfo/cmd/goversioninfo/main.go +++ /dev/null @@ -1,290 +0,0 @@ -// Contribution by Tamás Gulácsi - -package main - -import ( - "flag" - "fmt" - "io" - "log" - "os" - - "github.com/josephspurrier/goversioninfo" -) - -func main() { - flagExample := flag.Bool("example", false, "dump out an example versioninfo.json to stdout") - flagOut := flag.String("o", "resource.syso", "output file name") - flagGo := flag.String("gofile", "", "Go output file name (optional)") - flagPackage := flag.String("gofilepackage", "main", "Go output package name (optional, requires parameter: 'gofile')") - flagPlatformSpecific := flag.Bool("platform-specific", false, "output i386, amd64, arm and arm64 named resource.syso, ignores -o") - flagIcon := flag.String("icon", "", "icon file name(s), separated by commas") - flagManifest := flag.String("manifest", "", "manifest file name") - flagSkipVersion := flag.Bool("skip-versioninfo", false, "skip version info") - flagPropagateVerStrings := flag.Bool("propagate-ver-strings", false, - "fill FixedFileInfo version fields using FileVersion and ProductVersion from the StringFileInfo") - - flagComment := flag.String("comment", "", "StringFileInfo.Comments") - flagCompany := flag.String("company", "", "StringFileInfo.CompanyName") - flagDescription := flag.String("description", "", "StringFileInfo.FileDescription") - flagFileVersion := flag.String("file-version", "", "StringFileInfo.FileVersion") - flagInternalName := flag.String("internal-name", "", "StringFileInfo.InternalName") - flagCopyright := flag.String("copyright", "", "StringFileInfo.LegalCopyright") - flagTrademark := flag.String("trademark", "", "StringFileInfo.LegalTrademarks") - flagOriginalName := flag.String("original-name", "", "StringFileInfo.OriginalFilename") - flagPrivateBuild := flag.String("private-build", "", "StringFileInfo.PrivateBuild") - flagProductName := flag.String("product-name", "", "StringFileInfo.ProductName") - flagProductVersion := flag.String("product-version", "", "StringFileInfo.ProductVersion") - flagSpecialBuild := flag.String("special-build", "", "StringFileInfo.SpecialBuild") - - flagTranslation := flag.Int("translation", 0, "translation ID") - flagCharset := flag.Int("charset", 0, "charset ID") - - flag64 := flag.Bool("64", false, "generate 64-bit binaries") - flagarm := flag.Bool("arm", false, "generate arm binaries") - - flagVerMajor := flag.Int("ver-major", -1, "FileVersion.Major") - flagVerMinor := flag.Int("ver-minor", -1, "FileVersion.Minor") - flagVerPatch := flag.Int("ver-patch", -1, "FileVersion.Patch") - flagVerBuild := flag.Int("ver-build", -1, "FileVersion.Build") - - flagProductVerMajor := flag.Int("product-ver-major", -1, "ProductVersion.Major") - flagProductVerMinor := flag.Int("product-ver-minor", -1, "ProductVersion.Minor") - flagProductVerPatch := flag.Int("product-ver-patch", -1, "ProductVersion.Patch") - flagProductVerBuild := flag.Int("product-ver-build", -1, "ProductVersion.Build") - - flag.Usage = func() { - fmt.Fprintf(os.Stderr, "Usage: %s [flags] \n\nPossible flags:\n", os.Args[0]) - flag.PrintDefaults() - } - flag.Parse() - if *flagExample { - io.WriteString(os.Stdout, example) - return - } - - configFile := flag.Arg(0) - if configFile == "" { - configFile = "versioninfo.json" - } - - // Create a new container. - vi := &goversioninfo.VersionInfo{} - - if !*flagSkipVersion { - var err error - var input = io.ReadCloser(os.Stdin) - if configFile != "-" { - if input, err = os.Open(configFile); err != nil { - log.Printf("Cannot open %q: %v", configFile, err) - os.Exit(1) - } - } - - // Read the config file. - jsonBytes, err := io.ReadAll(input) - input.Close() - if err != nil { - log.Printf("Error reading %q: %v", configFile, err) - os.Exit(1) - } - - // Parse the config. - if err := vi.ParseJSON(jsonBytes); err != nil { - log.Printf("Could not parse the .json file: %v", err) - os.Exit(2) - } - - } - - // Override from flags. - if *flagIcon != "" { - vi.IconPath = *flagIcon - } - if *flagManifest != "" { - vi.ManifestPath = *flagManifest - } - if *flagComment != "" { - vi.StringFileInfo.Comments = *flagComment - } - if *flagCompany != "" { - vi.StringFileInfo.CompanyName = *flagCompany - } - if *flagDescription != "" { - vi.StringFileInfo.FileDescription = *flagDescription - } - if *flagFileVersion != "" { - vi.StringFileInfo.FileVersion = *flagFileVersion - } - if *flagInternalName != "" { - vi.StringFileInfo.InternalName = *flagInternalName - } - if *flagCopyright != "" { - vi.StringFileInfo.LegalCopyright = *flagCopyright - } - if *flagTrademark != "" { - vi.StringFileInfo.LegalTrademarks = *flagTrademark - } - if *flagOriginalName != "" { - vi.StringFileInfo.OriginalFilename = *flagOriginalName - } - if *flagPrivateBuild != "" { - vi.StringFileInfo.PrivateBuild = *flagPrivateBuild - } - if *flagProductName != "" { - vi.StringFileInfo.ProductName = *flagProductName - } - if *flagProductVersion != "" { - vi.StringFileInfo.ProductVersion = *flagProductVersion - } - if *flagSpecialBuild != "" { - vi.StringFileInfo.SpecialBuild = *flagSpecialBuild - } - - if *flagTranslation > 0 { - vi.VarFileInfo.Translation.LangID = goversioninfo.LangID(*flagTranslation) - } - if *flagCharset > 0 { - vi.VarFileInfo.Translation.CharsetID = goversioninfo.CharsetID(*flagCharset) - } - - // File Version flags. - if *flagVerMajor >= 0 { - vi.FixedFileInfo.FileVersion.Major = *flagVerMajor - } - if *flagVerMinor >= 0 { - vi.FixedFileInfo.FileVersion.Minor = *flagVerMinor - } - if *flagVerPatch >= 0 { - vi.FixedFileInfo.FileVersion.Patch = *flagVerPatch - } - if *flagVerBuild >= 0 { - vi.FixedFileInfo.FileVersion.Build = *flagVerBuild - } - - // Product Version flags. - if *flagProductVerMajor >= 0 { - vi.FixedFileInfo.ProductVersion.Major = *flagProductVerMajor - } - if *flagProductVerMinor >= 0 { - vi.FixedFileInfo.ProductVersion.Minor = *flagProductVerMinor - } - if *flagProductVerPatch >= 0 { - vi.FixedFileInfo.ProductVersion.Patch = *flagProductVerPatch - } - if *flagProductVerBuild >= 0 { - vi.FixedFileInfo.ProductVersion.Build = *flagProductVerBuild - } - - // Fill FixedFileInfo versions if needed. - if *flagPropagateVerStrings && vi.StringFileInfo.FileVersion != "" { - v, err := goversioninfo.NewFileVersion(vi.StringFileInfo.FileVersion) - if err != nil { - log.Printf("Unexpected StringFileInfo.FileVersion format: %v", err) - os.Exit(3) - } - vi.FixedFileInfo.FileVersion = v - } - if *flagPropagateVerStrings && vi.StringFileInfo.ProductVersion != "" { - v, err := goversioninfo.NewFileVersion(vi.StringFileInfo.ProductVersion) - if err != nil { - log.Printf("Unexpected StringFileInfo.ProductVersion format: %v", err) - os.Exit(3) - } - vi.FixedFileInfo.ProductVersion = v - } - - // Fill the structures with config data. - vi.Build() - - // Write the data to a buffer. - vi.Walk() - - // If the flag is set, then generate the optional Go file. - if *flagGo != "" { - vi.WriteGo(*flagGo, *flagPackage) - } - - // List of the architectures to output. - var archs []string - - // If platform specific, then output all the architectures for Windows. - if flagPlatformSpecific != nil && *flagPlatformSpecific { - archs = []string{"386", "amd64", "arm", "arm64"} - } else { - // Set the architecture, defaulted to 386(32-bit x86). - archs = []string{"386"} // 386(32-bit x86) - if flagarm != nil && *flagarm { - if flag64 != nil && *flag64 { - archs = []string{"arm64"} // arm64(64-bit arm64) - } else { - archs = []string{"arm"} // arm(32-bit arm) - } - } else { - if flag64 != nil && *flag64 { - archs = []string{"amd64"} // amd64(64-bit x86_64) - } - } - - } - - // Loop through each artchitecture. - for _, item := range archs { - // Create the file using the -o argument. - fileout := *flagOut - - // If the number of architectures is greater than one, then don't use - // the -o argument. - if len(archs) > 1 { - fileout = fmt.Sprintf("resource_windows_%v.syso", item) - } - - // Create the file for the specified architecture. - if err := vi.WriteSyso(fileout, item); err != nil { - log.Printf("Error writing syso: %v", err) - os.Exit(3) - } - } -} - -const example = `{ - "FixedFileInfo": { - "FileVersion": { - "Major": 6, - "Minor": 3, - "Patch": 9600, - "Build": 17284 - }, - "ProductVersion": { - "Major": 6, - "Minor": 3, - "Patch": 9600, - "Build": 17284 - }, - "FileFlagsMask": "3f", - "FileFlags ": "00", - "FileOS": "040004", - "FileType": "01", - "FileSubType": "00" - }, - "StringFileInfo": { - "Comments": "", - "CompanyName": "Company, Inc.", - "FileDescription": "", - "FileVersion": "6.3.9600.17284 (aaa.140822-1915)", - "InternalName": "goversioninfo", - "LegalCopyright": "© Author. Licensed under MIT.", - "LegalTrademarks": "", - "OriginalFilename": "goversioninfo", - "PrivateBuild": "", - "ProductName": "Go Version Info", - "ProductVersion": "6.3.9600.17284", - "SpecialBuild": "" - }, - "VarFileInfo": { - "Translation": { - "LangID": "0409", - "CharsetID": "04B0" - } - } -}` diff --git a/vendor/github.com/josephspurrier/goversioninfo/goversioninfo.go b/vendor/github.com/josephspurrier/goversioninfo/goversioninfo.go deleted file mode 100644 index 08b9932879..0000000000 --- a/vendor/github.com/josephspurrier/goversioninfo/goversioninfo.go +++ /dev/null @@ -1,362 +0,0 @@ -// Package goversioninfo creates a syso file which contains Microsoft Version Information and an optional icon. -package goversioninfo - -import ( - "bytes" - "encoding/json" - "fmt" - "io" - "log" - "os" - "reflect" - "regexp" - "strconv" - "strings" - - "github.com/akavel/rsrc/binutil" - "github.com/akavel/rsrc/coff" -) - -// ***************************************************************************** -// JSON and Config -// ***************************************************************************** - -// ParseJSON parses the given bytes as a VersionInfo JSON. -func (vi *VersionInfo) ParseJSON(jsonBytes []byte) error { - return json.Unmarshal([]byte(jsonBytes), &vi) -} - -// VersionInfo data container -type VersionInfo struct { - FixedFileInfo `json:"FixedFileInfo"` - StringFileInfo `json:"StringFileInfo"` - VarFileInfo `json:"VarFileInfo"` - Timestamp bool - Buffer bytes.Buffer - Structure VSVersionInfo - IconPath string `json:"IconPath"` - ManifestPath string `json:"ManifestPath"` -} - -// Translation with langid and charsetid. -type Translation struct { - LangID `json:"LangID"` - CharsetID `json:"CharsetID"` -} - -// FileVersion with 3 parts. -type FileVersion struct { - Major int - Minor int - Patch int - Build int -} - -// FixedFileInfo contains file characteristics - leave most of them at the defaults. -type FixedFileInfo struct { - FileVersion `json:"FileVersion"` - ProductVersion FileVersion - FileFlagsMask string - FileFlags string - FileOS string - FileType string - FileSubType string -} - -// VarFileInfo is the translation container. -type VarFileInfo struct { - Translation `json:"Translation"` -} - -// StringFileInfo is what you want to change. -type StringFileInfo struct { - Comments string - CompanyName string - FileDescription string - FileVersion string - InternalName string - LegalCopyright string - LegalTrademarks string - OriginalFilename string - PrivateBuild string - ProductName string - ProductVersion string - SpecialBuild string -} - -// ***************************************************************************** -// Helpers -// ***************************************************************************** - -// SizedReader is a *bytes.Buffer. -type SizedReader struct { - *bytes.Buffer -} - -// Size returns the length of the buffer. -func (s SizedReader) Size() int64 { - return int64(s.Buffer.Len()) -} - -func str2Uint32(s string) uint32 { - if s == "" { - return 0 - } - u, err := strconv.ParseUint(s, 16, 32) - if err != nil { - log.Printf("Error parsing %q as uint32: %v", s, err) - return 0 - } - - return uint32(u) -} - -func padString(s string, zeros int) []byte { - b := make([]byte, 0, len([]rune(s))*2) - for _, x := range s { - tt := int32(x) - - b = append(b, byte(tt)) - if tt > 255 { - tt = tt >> 8 - b = append(b, byte(tt)) - } else { - b = append(b, byte(0)) - } - } - - for i := 0; i < zeros; i++ { - b = append(b, 0x00) - } - - return b -} - -func padBytes(i int) []byte { - return make([]byte, i) -} - -// NewFileVersion parses semver version string into a FileVersion object -func NewFileVersion(version string) (FileVersion, error) { - re := regexp.MustCompile(`^(\d+)\.(\d+)\.(\d+)(?:\.(\d+))?`) - - comps := re.FindStringSubmatch(version) - if len(comps) == 0 { - return FileVersion{}, fmt.Errorf("version expected to start from x.y.z") - } - - // First match group is a whole matched string. - comps = comps[1:] - if comps[3] == "" { - comps = comps[:3] - } - - nums := make([]int, len(comps)) - for i := range nums { - n, err := strconv.Atoi(comps[i]) - if err != nil { - return FileVersion{}, fmt.Errorf("%s: %s", comps[i], err) - } - nums[i] = n - } - - res := FileVersion{ - Major: nums[0], - Minor: nums[1], - Patch: nums[2], - } - if len(nums) == 4 { - res.Build = nums[3] - } - return res, nil -} - -func (f FileVersion) getVersionHighString() string { - return fmt.Sprintf("%04x%04x", f.Major, f.Minor) -} - -func (f FileVersion) getVersionLowString() string { - return fmt.Sprintf("%04x%04x", f.Patch, f.Build) -} - -// GetVersionString returns a string representation of the version -func (f FileVersion) GetVersionString() string { - return fmt.Sprintf("%d.%d.%d.%d", f.Major, f.Minor, f.Patch, f.Build) -} - -func (t Translation) getTranslationString() string { - return fmt.Sprintf("%04X%04X", t.LangID, t.CharsetID) -} - -func (t Translation) getTranslation() string { - return fmt.Sprintf("%04x%04x", t.CharsetID, t.LangID) -} - -// ***************************************************************************** -// IO Methods -// ***************************************************************************** - -// Walk writes the data buffer with hexadecimal data from the structs -func (vi *VersionInfo) Walk() { - // Create a buffer - var b bytes.Buffer - w := binutil.Writer{W: &b} - - // Write to the buffer - binutil.Walk(vi.Structure, func(v reflect.Value, path string) error { - if binutil.Plain(v.Kind()) { - w.WriteLE(v.Interface()) - } - return nil - }) - - vi.Buffer = b -} - -// WriteSyso creates a resource file from the version info and optionally an icon. -// arch must be an architecture string accepted by coff.Arch, like "386" or "amd64" -func (vi *VersionInfo) WriteSyso(filename string, arch string) error { - - var i uint16 - newID := func() uint16 { - i++ - return i - } - - // Create a new RSRC section - rsrc := coff.NewRSRC() - - // Set the architecture - err := rsrc.Arch(arch) - if err != nil { - return err - } - - // ID 16 is for Version Information - rsrc.AddResource(16, 1, SizedReader{bytes.NewBuffer(vi.Buffer.Bytes())}) - - // If manifest is enabled - if vi.ManifestPath != "" { - - manifest, err := binutil.SizedOpen(vi.ManifestPath) - if err != nil { - return err - } - defer manifest.Close() - - id := newID() - rsrc.AddResource(rtManifest, id, manifest) - } - - // If icon is enabled - if vi.IconPath != "" { - if err := addIcon(rsrc, vi.IconPath, newID); err != nil { - return err - } - } - - rsrc.Freeze() - - // Write to file - return writeCoff(rsrc, filename) -} - -// WriteHex creates a hex file for debugging version info -func (vi *VersionInfo) WriteHex(filename string) error { - return os.WriteFile(filename, vi.Buffer.Bytes(), 0655) -} - -// WriteGo creates a Go file that contains the version info so you can access -// it in the application -func (vi *VersionInfo) WriteGo(filename, packageName string) error { - if len(packageName) == 0 { - packageName = "main" - } - - out, err := os.Create(filename) - if err != nil { - return err - } - - ffib, err := json.MarshalIndent(vi.FixedFileInfo, "\t", "\t") - if err != nil { - return err - } - - sfib, err := json.MarshalIndent(vi.StringFileInfo, "\t", "\t") - if err != nil { - return err - } - - vfib, err := json.MarshalIndent(vi.VarFileInfo, "\t", "\t") - if err != nil { - return err - } - - replace := "`\" + \"`\" + \"`" - str := "`{\n\t" - str += `"FixedFileInfo":` - str += strings.Replace(string(ffib), "`", replace, -1) - str += ",\n\t" - str += `"StringFileInfo":` - str += strings.Replace(string(sfib), "`", replace, -1) - str += ",\n\t" - str += `"VarFileInfo":` - str += strings.Replace(string(vfib), "`", replace, -1) - str += "\n" - str += "}`" - fmt.Fprintf(out, `// Auto-generated file by goversioninfo. Do not edit. -package %v - -import ( - "encoding/json" - - "github.com/josephspurrier/goversioninfo" -) - -func unmarshalGoVersionInfo(b []byte) goversioninfo.VersionInfo { - vi := goversioninfo.VersionInfo{} - json.Unmarshal(b, &vi) - return vi -} - -var versionInfo = unmarshalGoVersionInfo([]byte(%v)) -`, packageName, string(str)) - - return nil -} - -func writeCoff(coff *coff.Coff, fnameout string) error { - out, err := os.Create(fnameout) - if err != nil { - return err - } - if err = writeCoffTo(out, coff); err != nil { - return fmt.Errorf("error writing %q: %v", fnameout, err) - } - return nil -} - -func writeCoffTo(w io.WriteCloser, coff *coff.Coff) error { - bw := binutil.Writer{W: w} - - // write the resulting file to disk - binutil.Walk(coff, func(v reflect.Value, path string) error { - if binutil.Plain(v.Kind()) { - bw.WriteLE(v.Interface()) - return nil - } - vv, ok := v.Interface().(binutil.SizedReader) - if ok { - bw.WriteFromSized(vv) - return binutil.WALK_SKIP - } - return nil - }) - - err := bw.Err - if closeErr := w.Close(); closeErr != nil && err == nil { - err = closeErr - } - return err -} diff --git a/vendor/github.com/josephspurrier/goversioninfo/icon.go b/vendor/github.com/josephspurrier/goversioninfo/icon.go deleted file mode 100644 index 2d1681d611..0000000000 --- a/vendor/github.com/josephspurrier/goversioninfo/icon.go +++ /dev/null @@ -1,121 +0,0 @@ -package goversioninfo - -import ( - "bytes" - "encoding/binary" - "fmt" - "os" - "strings" - - "github.com/akavel/rsrc/coff" - "github.com/akavel/rsrc/ico" -) - -// ***************************************************************************** -/* -Code from https://github.com/akavel/rsrc - -The MIT License (MIT) - -Copyright (c) 2013-2014 The rsrc Authors. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. -*/ -// ***************************************************************************** - -const ( - rtIcon = coff.RT_ICON - rtGroupIcon = coff.RT_GROUP_ICON - rtManifest = coff.RT_MANIFEST -) - -// on storing icons, see: http://blogs.msdn.com/b/oldnewthing/archive/2012/07/20/10331787.aspx -type gRPICONDIR struct { - ico.ICONDIR - Entries []gRPICONDIRENTRY -} - -func (group gRPICONDIR) Size() int64 { - return int64(binary.Size(group.ICONDIR) + len(group.Entries)*binary.Size(group.Entries[0])) -} - -type gRPICONDIRENTRY struct { - ico.IconDirEntryCommon - ID uint16 -} - -func addIcon(coff *coff.Coff, fnames string, newID func() uint16) error { - for { - var fname1 string - var ok bool - fname1, fnames, ok = strings.Cut(fnames, ",") - if fname1 != "" { - if err := addOneIcon(coff, fname1, newID); err != nil { - return fmt.Errorf("%s: %w", fname1, err) - } - } - if !ok { - return nil - } - } -} - -func addOneIcon(coff *coff.Coff, fname string, newID func() uint16) error { - f, err := os.Open(fname) - if err != nil { - return err - } - defer f.Close() - - icons, err := ico.DecodeHeaders(f) - if err != nil { - return err - } - - if len(icons) > 0 { - // RT_ICONs - group := gRPICONDIR{ICONDIR: ico.ICONDIR{ - Reserved: 0, // magic num. - Type: 1, // magic num. - Count: uint16(len(icons)), - }} - gid := newID() - for _, icon := range icons { - id := newID() - buff, err := bufferIcon(f, int64(icon.ImageOffset), int(icon.BytesInRes)) - if err != nil { - return err - } - coff.AddResource(rtIcon, id, buff) - group.Entries = append(group.Entries, gRPICONDIRENTRY{IconDirEntryCommon: icon.IconDirEntryCommon, ID: id}) - } - coff.AddResource(rtGroupIcon, gid, group) - } - - return nil -} - -func bufferIcon(f *os.File, offset int64, size int) (*bytes.Reader, error) { - data := make([]byte, size) - _, err := f.ReadAt(data, offset) - if err != nil { - return nil, err - } - return bytes.NewReader(data), nil -} diff --git a/vendor/github.com/josephspurrier/goversioninfo/lang_cs.go b/vendor/github.com/josephspurrier/goversioninfo/lang_cs.go deleted file mode 100644 index 554c9fbf50..0000000000 --- a/vendor/github.com/josephspurrier/goversioninfo/lang_cs.go +++ /dev/null @@ -1,131 +0,0 @@ -// Contribution by Tamás Gulácsi - -package goversioninfo - -import ( - "encoding/json" - "strconv" -) - -// CharsetID must use be a character-set identifier from: -// https://msdn.microsoft.com/en-us/library/windows/desktop/aa381058(v=vs.85).aspx#charsetID -type CharsetID uint16 - -// CharsetID constants -const ( - Cs7ASCII = CharsetID(0) // Cs7ASCII: 0 0000 7-bit ASCII - CsJIS = CharsetID(932) // CsJIS: 932 03A4 Japan (Shift ? JIS X-0208) - CsKSC = CharsetID(949) // CsKSC: 949 03B5 Korea (Shift ? KSC 5601) - CsBig5 = CharsetID(950) // CsBig5: 950 03B6 Taiwan (Big5) - CsUnicode = CharsetID(1200) // CsUnicode: 1200 04B0 Unicode - CsLatin2 = CharsetID(1250) // CsLatin2: 1250 04E2 Latin-2 (Eastern European) - CsCyrillic = CharsetID(1251) // CsCyrillic: 1251 04E3 Cyrillic - CsMultilingual = CharsetID(1252) // CsMultilingual: 1252 04E4 Multilingual - CsGreek = CharsetID(1253) // CsGreek: 1253 04E5 Greek - CsTurkish = CharsetID(1254) // CsTurkish: 1254 04E6 Turkish - CsHebrew = CharsetID(1255) // CsHebrew: 1255 04E7 Hebrew - CsArabic = CharsetID(1256) // CsArabic: 1256 04E8 Arabic -) - -// UnmarshalJSON converts the string to a CharsetID -func (cs *CharsetID) UnmarshalJSON(p []byte) error { - if len(p) == 0 { - return nil - } - if p[0] != '"' { - var u uint16 - if err := json.Unmarshal(p, &u); err != nil { - return err - } - *cs = CharsetID(u) - return nil - } - var s string - if err := json.Unmarshal(p, &s); err != nil { - return err - } - u, err := strconv.ParseUint(s, 16, 16) - if err != nil { - return err - } - *cs = CharsetID(u) - return nil -} - -// LangID must use be a character-set identifier from: -// https://msdn.microsoft.com/en-us/library/windows/desktop/aa381058(v=vs.85).aspx#langID -type LangID uint16 - -// UnmarshalJSON converts the string to a LangID -func (lng *LangID) UnmarshalJSON(p []byte) error { - if len(p) == 0 { - return nil - } - if p[0] != '"' { - var u uint16 - if err := json.Unmarshal(p, &u); err != nil { - return err - } - *lng = LangID(u) - return nil - } - var s string - if err := json.Unmarshal(p, &s); err != nil { - return err - } - u, err := strconv.ParseUint(s, 16, 16) - if err != nil { - return err - } - *lng = LangID(u) - return nil -} - -// LangID constants -const ( - LngArabic = LangID(0x0401) // LngArabic: 0x0401 Arabic - LngBulgarian = LangID(0x0402) // LngBulgarian: 0x0402 Bulgarian - LngCatalan = LangID(0x0403) // LngCatalan: 0x0403 Catalan - LngTraditionalChinese = LangID(0x0404) // LngTraditionalChinese: 0x0404 Traditional Chinese - LngCzech = LangID(0x0405) // LngCzech: 0x0405 Czech - LngDanish = LangID(0x0406) // LngDanish: 0x0406 Danish - LngGerman = LangID(0x0407) // LngGerman: 0x0407 German - LngGreek = LangID(0x0408) // LngGreek: 0x0408 Greek - LngUSEnglish = LangID(0x0409) // LngUSEnglish: 0x0409 U.S. English - LngCastilianSpanish = LangID(0x040A) // LngCastilianSpanish: 0x040A Castilian Spanish - LngFinnish = LangID(0x040B) // LngFinnish: 0x040B Finnish - LngFrench = LangID(0x040C) // LngFrench: 0x040C French - LngHebrew = LangID(0x040D) // LngHebrew: 0x040D Hebrew - LngHungarian = LangID(0x040E) // LngHungarian: 0x040E Hungarian - LngIcelandic = LangID(0x040F) // LngIcelandic: 0x040F Icelandic - LngItalian = LangID(0x0410) // LngItalian: 0x0410 Italian - LngJapanese = LangID(0x0411) // LngJapanese: 0x0411 Japanese - LngKorean = LangID(0x0412) // LngKorean: 0x0412 Korean - LngDutch = LangID(0x0413) // LngDutch: 0x0413 Dutch - LngNorwegianBokmal = LangID(0x0414) // LngNorwegianBokmal: 0x0414 Norwegian ? Bokmal - LngPolish = LangID(0x0415) // LngPolish: 0x0415 Polish - LngPortugueseBrazil = LangID(0x0416) // LngPortugueseBrazil: 0x0416 Portuguese (Brazil) - LngRhaetoRomanic = LangID(0x0417) // LngRhaetoRomanic: 0x0417 Rhaeto-Romanic - LngRomanian = LangID(0x0418) // LngRomanian: 0x0418 Romanian - LngRussian = LangID(0x0419) // LngRussian: 0x0419 Russian - LngCroatoSerbianLatin = LangID(0x041A) // LngCroatoSerbianLatin: 0x041A Croato-Serbian (Latin) - LngSlovak = LangID(0x041B) // LngSlovak: 0x041B Slovak - LngAlbanian = LangID(0x041C) // LngAlbanian: 0x041C Albanian - LngSwedish = LangID(0x041D) // LngSwedish: 0x041D Swedish - LngThai = LangID(0x041E) // LngThai: 0x041E Thai - LngTurkish = LangID(0x041F) // LngTurkish: 0x041F Turkish - LngUrdu = LangID(0x0420) // LngUrdu: 0x0420 Urdu - LngBahasa = LangID(0x0421) // LngBahasa: 0x0421 Bahasa - LngSimplifiedChinese = LangID(0x0804) // LngSimplifiedChinese: 0x0804 Simplified Chinese - LngSwissGerman = LangID(0x0807) // LngSwiss German: 0x0807 Swiss German - LngUKEnglish = LangID(0x0809) // LngUKEnglish: 0x0809 U.K. English - LngSpanishMexico = LangID(0x080A) // LngSpanishMexico: 0x080A Spanish (Mexico) - LngBelgianFrench = LangID(0x080C) // LngBelgian French: 0x080C Belgian French - LngSwissItalian = LangID(0x0810) // LngSwiss Italian: 0x0810 Swiss Italian - LngBelgianDutch = LangID(0x0813) // LngBelgian Dutch: 0x0813 Belgian Dutch - LngNorwegianNynorsk = LangID(0x0814) // LngNorwegianNynorsk: 0x0814 Norwegian ? Nynorsk - LngPortuguesePortugal = LangID(0x0816) // LngPortuguese (Portugal): 0x0816 Portuguese (Portugal) - LngSerboCroatianCyrillic = LangID(0x081A) // LngSerboCroatianCyrillic: 0x081A Serbo-Croatian (Cyrillic) - LngCanadianFrench = LangID(0x0C0C) // LngCanadian French: 0x0C0C Canadian French - LngSwissFrench = LangID(0x100C) // LngSwiss French: 0x100C Swiss French -) diff --git a/vendor/github.com/josephspurrier/goversioninfo/structbuild.go b/vendor/github.com/josephspurrier/goversioninfo/structbuild.go deleted file mode 100644 index e5f9d8033a..0000000000 --- a/vendor/github.com/josephspurrier/goversioninfo/structbuild.go +++ /dev/null @@ -1,330 +0,0 @@ -package goversioninfo - -import ( - "reflect" -) - -// ***************************************************************************** -// Structure Building -// ***************************************************************************** - -/* -Version Information Structures -http://msdn.microsoft.com/en-us/library/windows/desktop/ff468916.aspx - -VersionInfo Names -http://msdn.microsoft.com/en-us/library/windows/desktop/aa381058.aspx#string-name - -Translation: LangID -http://msdn.microsoft.com/en-us/library/windows/desktop/aa381058.aspx#langid - -Translation: CharsetID -http://msdn.microsoft.com/en-us/library/windows/desktop/aa381058.aspx#charsetid - -*/ - -// VSVersionInfo is the top level version container. -type VSVersionInfo struct { - WLength uint16 - WValueLength uint16 - WType uint16 - SzKey []byte - Padding1 []byte - Value VSFixedFileInfo - Padding2 []byte - Children VSStringFileInfo - Children2 VSVarFileInfo -} - -// VSFixedFileInfo - most of these should be left at the defaults. -type VSFixedFileInfo struct { - DwSignature uint32 - DwStrucVersion uint32 - DwFileVersionMS uint32 - DwFileVersionLS uint32 - DwProductVersionMS uint32 - DwProductVersionLS uint32 - DwFileFlagsMask uint32 - DwFileFlags uint32 - DwFileOS uint32 - DwFileType uint32 - DwFileSubtype uint32 - DwFileDateMS uint32 - DwFileDateLS uint32 -} - -// VSStringFileInfo holds multiple collections of keys and values, -// only allows for 1 collection in this package. -type VSStringFileInfo struct { - WLength uint16 - WValueLength uint16 - WType uint16 - SzKey []byte - Padding []byte - Children VSStringTable -} - -// VSStringTable holds a collection of string keys and values. -type VSStringTable struct { - WLength uint16 - WValueLength uint16 - WType uint16 - SzKey []byte - Padding []byte - Children []VSString -} - -// VSString holds the keys and values. -type VSString struct { - WLength uint16 - WValueLength uint16 - WType uint16 - SzKey []byte - Padding []byte - Value []byte -} - -// VSVarFileInfo holds the translation collection of 1. -type VSVarFileInfo struct { - WLength uint16 - WValueLength uint16 - WType uint16 - SzKey []byte - Padding []byte - Value VSVar -} - -// VSVar holds the translation key. -type VSVar struct { - WLength uint16 - WValueLength uint16 - WType uint16 - SzKey []byte - Padding []byte - Value uint32 -} - -func buildString(i int, v reflect.Value) (VSString, bool) { - sValue := string(v.Field(i).Interface().(string)) - sName := v.Type().Field(i).Name - - ss := VSString{} - - // If the value is set - if sValue != "" { - // 0 for binary, 1 for text - ss.WType = 0x01 - - // Create key - ss.SzKey = padString(sName, 0) - - // Align to 32-bit boundary - soFar := 2 - for (len(ss.SzKey)+6+soFar)%4 != 0 { - soFar += 2 - } - ss.Padding = padBytes(soFar) - soFar += len(ss.SzKey) - - // Align zeros to 32-bit boundary - zeros := 2 - for (6+soFar+(len(padString(sValue, 0)))+zeros)%4 != 0 { - zeros += 2 - } - - // Create value - ss.Value = padString(sValue, zeros) - - // Length of text in words (2 bytes) plus zero terminate word - ss.WValueLength = uint16(len(padString(sValue, 0))/2) + 1 - - // Length of structure - //ss.WLength = 6 + uint16(soFar) + (ss.WValueLength * 2) - ss.WLength = uint16(6 + soFar + len(ss.Value)) - - return ss, true - } - - return ss, false -} - -func buildStringTable(vi *VersionInfo) VSStringTable { - st := VSStringTable{} - - // Always set to 0 - st.WValueLength = 0x00 - - // 0 for binary, 1 for text - st.WType = 0x01 - - // Language identifier and Code page - st.SzKey = padString(vi.VarFileInfo.Translation.getTranslationString(), 0) - - // Align to 32-bit boundary - soFar := 2 - for (len(st.SzKey)+6+soFar)%4 != 0 { - soFar += 2 - } - st.Padding = padBytes(soFar) - soFar += len(st.SzKey) - - // Loop through the struct fields - v := reflect.ValueOf(vi.StringFileInfo) - for i := 0; i < v.NumField(); i++ { - // If the struct is valid - if r, ok := buildString(i, v); ok { - st.Children = append(st.Children, r) - st.WLength += r.WLength - } - } - - st.WLength += 6 + uint16(soFar) - - return st -} - -func buildStringFileInfo(vi *VersionInfo) VSStringFileInfo { - sf := VSStringFileInfo{} - - // Always set to 0 - sf.WValueLength = 0x00 - - // 0 for binary, 1 for text - sf.WType = 0x01 - - sf.SzKey = padString("StringFileInfo", 0) - - // Align to 32-bit boundary - soFar := 2 - for (len(sf.SzKey)+6+soFar)%4 != 0 { - soFar += 2 - } - sf.Padding = padBytes(soFar) - soFar += len(sf.SzKey) - - // Allows for more than one string table - st := buildStringTable(vi) - sf.Children = st - - sf.WLength = 6 + uint16(soFar) + st.WLength - - return sf -} - -func buildVar(vfi VarFileInfo) VSVar { - vs := VSVar{} - - // 0 for binary, 1 for text - vs.WType = 0x00 - - // Create key - vs.SzKey = padString("Translation", 0) - - // Align to 32-bit boundary - soFar := 2 - for (len(vs.SzKey)+6+soFar)%4 != 0 { - soFar += 2 - } - vs.Padding = padBytes(soFar) - soFar += len(vs.SzKey) - - // Create value - vs.Value = str2Uint32(vfi.Translation.getTranslation()) - - // Length of text in bytes - vs.WValueLength = 4 - - // Length of structure - vs.WLength = 6 + vs.WValueLength + uint16(soFar) - - return vs -} - -func buildVarFileInfo(vfi VarFileInfo) VSVarFileInfo { - vf := VSVarFileInfo{} - - // Always set to 0 - vf.WValueLength = 0x00 - - // 0 for binary, 1 for text - vf.WType = 0x01 - - vf.SzKey = padString("VarFileInfo", 0) - - // Align to 32-bit boundary - soFar := 2 - for (len(vf.SzKey)+6+soFar)%4 != 0 { - soFar += 2 - } - vf.Padding = padBytes(soFar) - soFar += len(vf.SzKey) - - // TODO Allow for more than one var table - st := buildVar(vfi) - vf.Value = st - vf.WLength = 6 + st.WLength + uint16(soFar) - - return vf -} - -func buildFixedFileInfo(vi *VersionInfo) VSFixedFileInfo { - ff := VSFixedFileInfo{} - ff.DwSignature = 0xFEEF04BD - ff.DwStrucVersion = 0x00010000 - ff.DwFileVersionMS = str2Uint32(vi.FixedFileInfo.FileVersion.getVersionHighString()) - ff.DwFileVersionLS = str2Uint32(vi.FixedFileInfo.FileVersion.getVersionLowString()) - ff.DwProductVersionMS = str2Uint32(vi.FixedFileInfo.ProductVersion.getVersionHighString()) - ff.DwProductVersionLS = str2Uint32(vi.FixedFileInfo.ProductVersion.getVersionLowString()) - ff.DwFileFlagsMask = str2Uint32(vi.FixedFileInfo.FileFlagsMask) - ff.DwFileFlags = str2Uint32(vi.FixedFileInfo.FileFlags) - ff.DwFileOS = str2Uint32(vi.FixedFileInfo.FileOS) - ff.DwFileType = str2Uint32(vi.FixedFileInfo.FileType) - ff.DwFileSubtype = str2Uint32(vi.FixedFileInfo.FileSubType) - - // According to the spec, these should be zero...ugh - /*if vi.Timestamp { - now := syscall.NsecToFiletime(time.Now().UnixNano()) - ff.DwFileDateMS = now.HighDateTime - ff.DwFileDateLS = now.LowDateTime - }*/ - - return ff -} - -// Build fills the structs with data from the config file -func (v *VersionInfo) Build() { - vi := VSVersionInfo{} - - // 0 for binary, 1 for text - vi.WType = 0x00 - - vi.SzKey = padString("VS_VERSION_INFO", 0) - - // Align to 32-bit boundary - // 6 is for the size of WLength, WValueLength, and WType (each is 1 word or 2 bytes: FF FF) - soFar := 2 - for (len(vi.SzKey)+6+soFar)%4 != 0 { - soFar += 2 - } - vi.Padding1 = padBytes(soFar) - soFar += len(vi.SzKey) - - vi.Value = buildFixedFileInfo(v) - - // Length of VSFixedFileInfo (always the same) - vi.WValueLength = 0x34 - - // Never needs padding, not included in WLength - vi.Padding2 = []byte{} - - // Build strings - vi.Children = buildStringFileInfo(v) - - // Build translation - vi.Children2 = buildVarFileInfo(v.VarFileInfo) - - // Calculate the total size - vi.WLength += 6 + uint16(soFar) + vi.WValueLength + vi.Children.WLength + vi.Children2.WLength - - v.Structure = vi -} diff --git a/vendor/modules.txt b/vendor/modules.txt index 42cbba483d..c9d971c854 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -31,11 +31,6 @@ github.com/OneOfOne/xxhash # github.com/agnivade/levenshtein v1.2.0 ## explicit; go 1.21 github.com/agnivade/levenshtein -# github.com/akavel/rsrc v0.10.2 -## explicit; go 1.12 -github.com/akavel/rsrc/binutil -github.com/akavel/rsrc/coff -github.com/akavel/rsrc/ico # github.com/beorn7/perks v1.0.1 ## explicit; go 1.11 github.com/beorn7/perks/quantile @@ -277,10 +272,6 @@ github.com/google/uuid # github.com/gorilla/mux v1.8.1 ## explicit; go 1.20 github.com/gorilla/mux -# github.com/josephspurrier/goversioninfo v1.5.0 -## explicit; go 1.18 -github.com/josephspurrier/goversioninfo -github.com/josephspurrier/goversioninfo/cmd/goversioninfo # github.com/klauspost/compress v1.18.5 ## explicit; go 1.24 github.com/klauspost/compress