Installation
Prerequisites
- Go 1.21+ – Download from go.dev
Verify your Go installation:
go version
# go version go1.21.0 linux/amd64CLI Installation
Install the gofhir-validator command-line tool:
go install github.com/gofhir/validator/cmd/gofhir-validator@latestVerify the installation:
gofhir-validator -vLibrary Installation
To use the validator as a Go library in your project:
go get github.com/gofhir/validatorThis adds the validator module to your go.mod and makes the validator package available for import.
FHIR Package Cache Setup
The GoFHIR Validator uses the standard FHIR package cache located at ~/.fhir/packages/. This is the same cache used by other FHIR tools such as the HL7 Validator and SUSHI.
Installing FHIR Core Packages
If you need the full package cache (for example, for offline terminology validation or custom profile resolution), install the core packages using the NPM FHIR package registry:
# Create the FHIR package cache directory
mkdir -p ~/.fhir/packages
# Install FHIR R4 core package
npm --registry https://packages.fhir.org install hl7.fhir.r4.core@4.0.1
# Install FHIR R4 expansions (terminology)
npm --registry https://packages.fhir.org install hl7.fhir.r4.expansions@4.0.1Installing Implementation Guides
To validate against a specific implementation guide, install its package:
# Example: US Core
npm --registry https://packages.fhir.org install hl7.fhir.us.core@6.1.0
# Example: International Patient Summary
npm --registry https://packages.fhir.org install hl7.fhir.uv.ips@1.1.0Next Steps
Once installed, head to the Quick Start guide to validate your first FHIR resource.