<commit_before>package microservicecore

import (
	"log"
	"os"
)

// GetEnvOrFail - Get an environment variable by name.
//
// Or if the requested variable does not exist, throw a fatal error.
//
// Params:
//     name string - The name of the environment variable to get.
//
// Return:
//     string - The value of the requested environment variable.
func GetEnvOrFail(name string) string {
	envVar := os.Getenv(name)
	if envVar == "" {
		log.Fatalf("Environment variable (%s) has not been set.", name)
	}

	return envVar
}<commit_msg>distinguish between empty and unset env var (#8)<commit_after>package microservicecore

import (
	"log"
	"os"
)

// GetEnvOrFail - Get an environment variable by name.
//
// Or if the requested variable does not exist, throw a fatal error.
//
// Params:
//     name string - The name of the environment variable to get.
//
// Return:
//     string - The value of the requested environment variable.
func GetEnvOrFail(name string) string {
	envVar, ok := os.LookupEnv(name)
	if !ok {
		log.Fatalf("environment variable (%s) has not been set", name)
	}
	if envVar == "" {
		log.Fatalf("environment variable (%s) is empty", name)
	}
	return envVar
}
{'fraction_non_alphanumeric': 0.11759729272419628, 'fraction_numerical': 0.0008460236886632825, 'mean_word_length': 3.225, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5223689', 'n_tokens_mistral': 368, 'n_tokens_neox': 363, 'n_words': 140}