You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: sso_cached_token.go
    path of file: ./repos/streamdal/apps/server/vendor/github.com/aws/aws-sdk-go/aws/credentials/ssocreds
    
    the code of the file until where you have to start completion: package ssocreds

import (
	"crypto/sha1"
	"encoding/hex"
	"encoding/json"
	"fmt"
	"github.com/aws/aws-sdk-go/internal/shareddefaults"
	"io/ioutil"
	"os"
	"path/filepath"
	"strconv"
	"strings"
	"time"
)

var resolvedOsUserHomeDir = shareddefaults.UserHom
    
func storeCachedToken(filename string, t cachedToken, fileMode os.FileMode) (err error) {
	tmpFilename := filename + ".tmp-" + strconv.FormatInt(nowTime().UnixNano(), 10)
	if err := writeCacheFile(tmpFilename, fileMode, t); err != nil {
		return err
	}

	if err := os.Rename(tmpFilename, filename); err != nil {
		return fmt.Errorf("failed to replace old cached SSO token file, %v", err)
	}

	return nil
}