func (f *fileCredentialCache) Load() *credentials.Credentials {
	f.mu.RLock()
	defer f.mu.RUnlock()
	creds := new(credentials.Credentials)
	stsCreds := new(types.Credentials)
	data, err := os.ReadFile(f.path)
	if err != nil {
		return creds
	}
	if err := json.Unmarshal(data, stsCreds); err != nil {
		return creds
	}
	creds = credentials.FromStsCredentials(stsCreds)
	if !creds.Value().HasKeys() {
		return new(credentials.Credentials)
	}
	return creds
}
Load the cached credentials from the file, if no cached credentials are found an expired set of credentials
is returned.
package cache
import (
	"encoding/json"
	"fmt"
	"github.com/aws/aws-sdk-go-v2/service/sts/types"
	"github.com/mmmorris1975/aws-runas/credentials"
	"os"
	"path/filepath"
	"sync"
)
type fileCredentialCache struct {
	path string
	mu   sync.RWMutex
}
func NewFileCredentialCache(path string) *fileCredentialCache {
	return &fileCredentialCache{path: path}
}