Repository: etcd-io/etcd (language: go)

Issue:
Fix `make verify` errors in arm64 (OSX)
### Bug report criteria

- [x] This bug report is not security related, security issues should be disclosed privately via [etcd maintainers](mailto:etcd-maintainers@googlegroups.com).
- [x] This is not a support request or question, support requests or questions should be raised in the etcd [discussion forums](https://github.com/etcd-io/etcd/discussions).
- [x] You have read the etcd [bug reporting guidelines](https://github.com/etcd-io/etcd/blob/main/Documentation/contributor-guide/reporting_bugs.md).
- [x] Existing open issues along with etcd [frequently asked questions](https://etcd.io/docs/latest/faq) have been checked and this is not a duplicate.

### What happened?

Running `make verify` on ARM64 fails. Some tools (shellcheck and marker) have hard-coded the architecture and the operating system (Linux/AMD64). Also, verifying the BOM fails due to missing releases from some dependencies for the given architecture.

### What did you expect to happen?

`make verify` should exit without errors.

### How can we reproduce it (as minimally and precisely as possible)?

Run `make verify` on an ARM64 OSX computer.

### Anything else we need to know?

_No response_

### Etcd version (please run commands below)

<details>

```console
$ etcd --version
# paste output here

$ etcdctl version
# paste output here
```

</details>


### Etcd configuration (command line flags or environment variables)

<details>

# paste your configuration here

</details>


### Etcd debug information (please run commands below, feel free to obfuscate the IP address or FQDN in the output)

<details>

```console
$ etcdctl member list -w table
# paste output here

$ etcdctl --endpoints=<member list> endpoint status -w table
# paste output here
```

</details>


### Relevant log output

```Shell

```


Discussion / hints:
@Dogacel, can I assign you to this task?

I feel like the right way to address the BOM issue, is to make it optional for ARM64. Then skip creating it in `./scripts/updatebom.sh` if the arch is ARM64.
> [@Dogacel](https://github.com/Dogacel), can I assign you to this task?
> 
> I feel like the right way to address the BOM issue, is to make it optional for ARM64. Then skip creating it in `./scripts/updatebom.sh` if the arch is ARM64.

Sure! Thanks 🙂 
/assign @Dogacel 

Fix patch:
diff --git a/scripts/updatebom.sh b/scripts/updatebom.sh
index 2c6bf8720b0..a1de4a8763b 100755
--- a/scripts/updatebom.sh
+++ b/scripts/updatebom.sh
@@ -14,7 +14,10 @@ function bom_fixlet {
   # shellcheck disable=SC2207
   modules=($(modules_for_bom))
 
-  if GOFLAGS=-mod=mod run_go_tool "github.com/appscodelabs/license-bill-of-materials" \
+  # BOM file should be generated for linux. Otherwise running this command on other operating systems such as OSX
+  # results in certain dependencies being excluded from the BOM file, such as procfs. 
+  # For more info, https://github.com/etcd-io/etcd/issues/19665
+  if GOOS=linux GOFLAGS=-mod=mod run_go_tool "github.com/appscodelabs/license-bill-of-materials" \
       --override-file ./bill-of-materials.override.json \
       "${modules[@]}" > ./bill-of-materials.json.tmp; then
     cp ./bill-of-materials.json.tmp ./bill-of-materials.json


Test patch:
diff --git a/scripts/test.sh b/scripts/test.sh
index 00ba2c0b22b..e84442374fb 100755
--- a/scripts/test.sh
+++ b/scripts/test.sh
@@ -502,7 +502,10 @@ function bom_pass {
   run cp go.sum go.sum.tmp || return 2
   run cp go.mod go.mod.tmp || return 2
 
-  output=$(GOFLAGS=-mod=mod run_go_tool github.com/appscodelabs/license-bill-of-materials \
+  # BOM file should be generated for linux. Otherwise running this command on other operating systems such as OSX
+  # results in certain dependencies being excluded from the BOM file, such as procfs. 
+  # For more info, https://github.com/etcd-io/etcd/issues/19665
+  output=$(GOOS=linux GOFLAGS=-mod=mod run_go_tool github.com/appscodelabs/license-bill-of-materials \
     --override-file ./bill-of-materials.override.json \
     "${modules[@]}")
   code="$?"
diff --git a/scripts/test_lib.sh b/scripts/test_lib.sh
index 2f5e0a8106f..31ca532b0da 100644
--- a/scripts/test_lib.sh
+++ b/scripts/test_lib.sh
@@ -320,7 +320,7 @@ function tool_pkg_dir {
 # tool_get_bin [tool]
 function run_go_tool {
   local cmdbin
-  if ! cmdbin=$(GOARCH="" tool_get_bin "${1}"); then
+  if ! cmdbin=$(GOARCH="" GOOS="" tool_get_bin "${1}"); then
     log_warning "Failed to install tool '${1}'"
     return 2
   fi