{"id":17740592,"url":"https://github.com/rusq/osenv","last_synced_at":"2026-05-01T15:31:51.976Z","repository":{"id":42920768,"uuid":"189903898","full_name":"rusq/osenv","owner":"rusq","description":"Extended version of os.Getenv with defaults","archived":false,"fork":false,"pushed_at":"2022-03-26T10:27:59.000Z","size":28,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-01-21T23:21:24.610Z","etag":null,"topics":["environment","getenv","golang","module","os","setenv"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rusq.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-06-02T23:04:43.000Z","updated_at":"2022-05-25T09:51:47.000Z","dependencies_parsed_at":"2022-09-09T14:12:04.127Z","dependency_job_id":null,"html_url":"https://github.com/rusq/osenv","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/rusq/osenv","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rusq%2Fosenv","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rusq%2Fosenv/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rusq%2Fosenv/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rusq%2Fosenv/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rusq","download_url":"https://codeload.github.com/rusq/osenv/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rusq%2Fosenv/sbom","scorecard":{"id":790235,"data":{"date":"2025-08-11","repo":{"name":"github.com/rusq/osenv","commit":"8999df43b3c28ad8808719713a939bb855323d5c"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.8,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/go.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Code-Review","score":0,"reason":"Found 0/8 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/go.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/rusq/osenv/go.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/go.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/rusq/osenv/go.yml/master?enable=pin","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":9,"reason":"license file detected","details":["Info: project has a license file: LICENCE:0","Warn: project license file does not contain an FSF or OSI license."],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 15 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-23T07:18:29.985Z","repository_id":42920768,"created_at":"2025-08-23T07:18:29.986Z","updated_at":"2025-08-23T07:18:29.986Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32502993,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-30T13:12:12.517Z","status":"online","status_checked_at":"2026-05-01T02:00:05.856Z","response_time":64,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["environment","getenv","golang","module","os","setenv"],"created_at":"2024-10-26T03:06:41.963Z","updated_at":"2026-05-01T15:31:51.953Z","avatar_url":"https://github.com/rusq.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# OS Environment\n\n[![Go Reference](https://pkg.go.dev/badge/github.com/rusq/osenv.svg)][1]\n\nThis package aims to provide extension of the `os.Getenv` that\nsupports different types of variable types, and allows to specify a\ndefault value, in case the environment variable is missing.\n\nThis version is implemented with [Go 1.18+ generics][2].  If you need\nto use the package's functionailty in Go versions prior to 1.18, see\nbelow.\n\nThere are two versions of the package:\n\n- v2: uses generics, therefore can only be compiled with Go 1.18+\n  (this version).\n- v1: supports Go versions 1.12+.\n\nGo 1.18+ (v2):\n```go\nimport \"github.com/rusq/osenv/v2\"\n```\n\nGo 1.12+ (v1):\n```go\nimport \"github.com/rusq/osenv\"\n```\n\n## Usage\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"math\"\n\t\"time\"\n\n\t\"github.com/rusq/osenv/v2\"\n)\n\nfunc main() {\n\tfmt.Printf(\"OSENV_BOOL: %v\\n\"+\n\t\t\"OSENV_DURATION: %s\\n\"+\n\t\t\"OSENV_FLOAT: %.7f\\n\"+\n\t\t\"OSENV_INT: %d\\n\"+\n\t\t\"OSENV_INT64: %d\\n\"+\n\t\t\"OSENV_STRING: %s\\n\"+\n\t\t\"OSENV_TIME: %s\\n\",\n\n\t\tosenv.Value(\"OSENV_BOOL\", true),\n\t\tosenv.Value(\"OSENV_DURATION\", 60*time.Second),\n\t\tosenv.Value(\"OSENV_FLOAT\", math.Pi),\n\t\tosenv.Value(\"OSENV_INT\", math.MaxInt32),\n\t\tosenv.Value(\"OSENV_INT64\", math.MaxInt64),\n\t\tosenv.Value(\"OSENV_STRING\", \"default string value\"),\n\t\tosenv.Value(\"OSENV_TIME\", time.Date(2020, 12, 31, 23, 59, 59, 0, time.UTC)),\n\t)\n}\n```\n\nFor more examples, refer to [package documentation][1]\n\nThe package defines a single function that handles all supported\ntypes:\n\n- Boolean\n- time.Duration \n- Float64\n- Int\n- Int64\n- String\n- Secret*\n- Time\n\nFor all of these types, call `osenv.Value(...)`.\n\n\\* Secret obtains a string from the environment (`osenv.Secret`).  The\nonly difference between `Value` and `Secret`, is that Secret unsets\nthe environment variable after getting the value.\n\n## Upgrading from v1 to v2\n\nIf you were using osenv/v1 before, and upgrading to osenv/v2, follow\nthe instructions in this section.\n\nReplace the call to the function in \"From\" with the call to the\nfunction in \"To\":\n\n| From           | To          |\n|----------------|-------------|\n| osenv.Bool     | osenv.Value |\n| osenv.Duration | osenv.Value |\n| osenv.Float    | osenv.Value |\n| osenv.Int      | osenv.Value |\n| osenv.Int64    | osenv.Value |\n| osenv.Time     | osenv.Value |\n| osenv.String   | osenv.Value |\n\n[1]: https://pkg.go.dev/github.com/rusq/osenv\n[2]: https://go.dev/blog/intro-generics\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frusq%2Fosenv","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frusq%2Fosenv","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frusq%2Fosenv/lists"}