Windows and linux packages are different
- Dominant language
- Go
- Stars
- 673
- Forks
- 188
- PR merge metrics
- No merged PRs in 30d
Description
Hi,
My code which builds correctly on linux does not on windows, as if the packages were not the same based on the OS it is being built upon.
I noticed later that indeed, in the documentation, it is rendered according to the user preference (well according to the user's machine)

E.g., on windows it's `OpenTPM()` and on linux it's `OpenTPM(string)`
I can use [build constraints](https://pkg.go.dev/go/build#hdr-Build_Constraints) and provide the tag during the build.
That would imply having 2 files, one targeting windows and another linux.
I understand that the reason why they have been seperated is that access to the TPM is different from one OS to another.
It still made me wonder, is there a better way to have a code base that would work regardless of the OS ?
Cheers,
Contributor guide
Research direction
Start by comparing the OpenTPM entry points and the platform-specific package documentation referenced in the issue. Review Go build constraints and the Windows and Linux TPM implementations to determine whether a common API is feasible. Done means the cross-platform behavior is clearly resolved or the platform limitation is documented with a concrete direction.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- operating-systems, security
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100