{"id":27360702,"url":"https://github.com/0x19/solc-switch","last_synced_at":"2025-10-11T01:47:11.593Z","repository":{"id":189297522,"uuid":"679890555","full_name":"0x19/solc-switch","owner":"0x19","description":"A Concurrent Solidity Manager and Compiler in Go","archived":false,"fork":false,"pushed_at":"2024-03-28T09:00:16.000Z","size":106,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-13T01:09:50.577Z","etag":null,"topics":["golang","solidity-compiler"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/0x19.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2023-08-17T21:18:03.000Z","updated_at":"2023-08-19T07:40:04.000Z","dependencies_parsed_at":null,"dependency_job_id":"bd698613-6d7d-443e-b722-be433de88b33","html_url":"https://github.com/0x19/solc-switch","commit_stats":null,"previous_names":["0x19/solc-switch"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/0x19/solc-switch","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0x19%2Fsolc-switch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0x19%2Fsolc-switch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0x19%2Fsolc-switch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0x19%2Fsolc-switch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/0x19","download_url":"https://codeload.github.com/0x19/solc-switch/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0x19%2Fsolc-switch/sbom","scorecard":{"id":507,"data":{"date":"2025-08-11","repo":{"name":"github.com/0x19/solc-switch","commit":"60e0ba7de68078a81ee33d7a071b441118e71111"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.8,"checks":[{"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":"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":"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":"Code-Review","score":0,"reason":"Found 0/10 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":"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/gosec.yml:10: update your workflow using https://app.stepsecurity.io/secureworkflow/0x19/solc-switch/gosec.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/gosec.yml:13: update your workflow using https://app.stepsecurity.io/secureworkflow/0x19/solc-switch/gosec.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/goveralls.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/0x19/solc-switch/goveralls.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/goveralls.yml:18: update your workflow using https://app.stepsecurity.io/secureworkflow/0x19/solc-switch/goveralls.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/goveralls.yml:26: update your workflow using https://app.stepsecurity.io/secureworkflow/0x19/solc-switch/goveralls.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/goveralls.yml:37: update your workflow using https://app.stepsecurity.io/secureworkflow/0x19/solc-switch/goveralls.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:10: update your workflow using https://app.stepsecurity.io/secureworkflow/0x19/solc-switch/test.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:13: update your workflow using https://app.stepsecurity.io/secureworkflow/0x19/solc-switch/test.yml/main?enable=pin","Info:   0 out of   5 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   3 third-party 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":"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/gosec.yml:1","Warn: no topLevel permission defined: .github/workflows/goveralls.yml:1","Warn: no topLevel permission defined: .github/workflows/test.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":"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":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: Apache License 2.0: LICENSE:0"],"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":"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"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 27 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"}}]},"last_synced_at":"2025-08-14T12:24:23.656Z","repository_id":189297522,"created_at":"2025-08-14T12:24:23.657Z","updated_at":"2025-08-14T12:24:23.657Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279005937,"owners_count":26083987,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-10T02:00:06.843Z","response_time":62,"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":["golang","solidity-compiler"],"created_at":"2025-04-13T01:09:49.650Z","updated_at":"2025-10-11T01:47:11.577Z","avatar_url":"https://github.com/0x19.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://github.com/0x19/solc-switch/actions/workflows/test.yml/badge.svg)](https://github.com/0x19/solc-switch/actions/workflows/test.yml)\n[![Security Status](https://github.com/0x19/solc-switch/actions/workflows/gosec.yml/badge.svg)](https://github.com/0x19/solc-switch/actions/workflows/gosec.yml)\n[![Coverage Status](https://coveralls.io/repos/github/0x19/solc-switch/badge.svg?branch=main)](https://coveralls.io/github/0x19/solc-switch?branch=main)\n[![Go Report Card](https://goreportcard.com/badge/github.com/0x19/solc-switch)](https://goreportcard.com/report/github.com/0x19/solc-switch)\n[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n[![PkgGoDev](https://pkg.go.dev/badge/github.com/0x19/solc-switch)](https://pkg.go.dev/github.com/0x19/solc-switch)\n\n# Solc-Switch: A Concurrent Solidity Manager \u0026 Compiler in Go\n\n**solc-switch** is your partner in streamlining the Solidity development process. Built with Go, it's designed to let developers seamlessly switch between different Solidity compiler versions, ensuring optimal compatibility and a frictionless development experience.\n\nWhile **solc-switch** is lightweight, fast, and intuitive, it's primarily tailored for APIs and other integration tools. If you're on the hunt for a CLI-based solution, consider exploring [solc-select](https://github.com/crytic/solc-select).\n\n## Under the Hood: Execution Mechanics\n\n**solc-switch** makes use of the `os/exec` package to carry out compilation commands. This method is direct and gets the job done, but it's worth mentioning that it may not always be the best fit for every situation. I've thought about leveraging **CGO** to directly incorporate the C++ code of the Solidity compiler. But when I considered the challenges of handling over 100 Solidity releases and the nuances of build time, it became clear that this route might be a bit too ambitious and not necessarily beneficial. My main aim is to strike a balance between efficiency, ease of maintenance, and user experience.\n\n## Highlighted Features\n\n- **Speedy Downloads:** Parallel downloading of multiple Solidity compiler versions ensures you're not waiting around.\n- **Smooth Version Switching:** Navigate between different Solidity compiler versions without a hitch.\n- **Always in the Loop:** With automatic updates, always have access to the latest releases from the official Solidity GitHub repository.\n- **Broad Compatibility:** Crafted with MacOS and Linux in mind, and potentially adaptable for Windows.\n\n📢 **Note for Windows Enthusiasts:** Testing on a Windows environment hasn't been done yet. If you're a Windows user, your feedback on its functionality would be invaluable. If you're passionate about contributing, your PRs are more than welcome!\n\n## Documentation\n\nFor a comprehensive overview of `solc-switch`, its functions, and detailed usage instructions, please refer to the [official documentation](https://pkg.go.dev/github.com/0x19/solc-switch).\n\n## Installation\n\nTo use solc-switch in your project, you don't need a separate installation. Simply import it directly:\n\n```go\nimport \"github.com/0x19/solc-switch\"\n```\n\n### Setting Up Environment Variable\n\nBefore you start, ensure you've set up the required environment variable for the GitHub personal access token:\n\n```bash\nexport SOLC_SWITCH_GITHUB_TOKEN=\"{your_github_token_here}\"\n```\n\nReplace **{your_github_token_here}** with your actual GitHub personal access token. If you don't have one, you can create it by following the instructions [here](https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token).\n\nIt is used to fetch the latest Solidity compiler releases from the official Solidity GitHub repository. If you don't set it up, you'll get an rate limit error quite quickly.\n\n## Example Usage\n\nBelow is a simple example demonstrating how to use **solc-switch** to compile a Solidity smart contract:\n\n```go\npackage main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"time\"\n\n\t\"github.com/0x19/solc-switch\"\n\t\"github.com/davecgh/go-spew/spew\"\n\t\"go.uber.org/zap\"\n\t\"go.uber.org/zap/zapcore\"\n)\n\nfunc main() {\n\t// Sample Solidity contract for demonstration purposes\n\tsourceCode := `\n\t// SPDX-License-Identifier: MIT\n\tpragma solidity ^0.8.0;\n\n\tcontract SimpleStorage {\n\t\tuint256 private storedData;\n\n\t\tfunction set(uint256 x) public {\n\t\t\tstoredData = x;\n\t\t}\n\n\t\tfunction get() public view returns (uint256) {\n\t\t\treturn storedData;\n\t\t}\n\t}\n\t`\n\n\t// Create a context with cancellation capabilities\n\tctx, cancel := context.WithCancel(context.Background())\n\tdefer cancel()\n\n\t// Initialize a development logger for solc-switch\n\tlogger, err := solc.GetDevelopmentLogger(zapcore.ErrorLevel)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tzap.ReplaceGlobals(logger)\n\n\t// Create a default configuration for solc-switch\n\tsolcConfig, err := solc.NewDefaultConfig()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// Initialize the solc-switch manager with the provided configuration\n\tsolcManager, err := solc.New(ctx, solcConfig)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// Increase the default HTTP client timeout to ensure successful fetching of compiler versions\n\tsolcConfig.SetHttpClientTimeout(60 * time.Second)\n\n\t// Sync with the official Solidity GitHub repository to ensure the latest compiler versions are available locally\n\tif err := solcManager.Sync(); err != nil {\n\t\tpanic(err)\n\t}\n\n\t// Revert the HTTP client timeout to a shorter duration post-sync\n\tsolcConfig.SetHttpClientTimeout(10 * time.Second)\n\n\t// Create a default compiler configuration targeting Solidity version \"0.8.0\"\n\tcompilerConfig, err := solc.NewDefaultCompilerConfig(\"0.8.0\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// Start the timer to measure the compilation time\n\tstartTime := time.Now()\n\n\t// Compile the provided Solidity source code using the specified compiler configuration\n\tresults, err := solcManager.Compile(ctx, sourceCode, compilerConfig)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// Calculate the time taken for the compilation\n\ttimeTaken := time.Since(startTime)\n\n\t// Display the compilation results for review\n\tspew.Dump(results)\n\n\t// Print the time taken for the compilation\n\tfmt.Printf(\"Time took: %s\\n\", timeTaken)\n}\n\n```\n\n### Compilation Results\n\n- **Requested Compiler Version:** 0.8.0\n- **Compiler Version:** 0.8.0+commit.c7dfd78e.Linux.g++\n- **Contract Name:** SimpleStorage\n\n```shell\n(*solc.CompilerResults)(0xc0002faa80)({\n RequestedVersion: (string) (len=5) \"0.8.0\",\n CompilerVersion: (string) (len=31) \"0.8.0+commit.c7dfd78e.Linux.g++\",\n Bytecode: (string) (len=670) \"608060405234801561001057600080fd5b5061012f806100206000396000f3fe6080604052348015600f57600080fd5b506004361060325760003560e01c806360fe47b11460375780636d4ce63c14604f575b600080fd5b604d600480360381019060499190608f565b6069565b005b60556073565b6040516060919060c2565b60405180910390f35b8060008190555050565b60008054905090565b60008135905060898160e5565b92915050565b60006020828403121560a057600080fd5b600060ac84828501607c565b91505092915050565b60bc8160db565b82525050565b600060208201905060d5600083018460b5565b92915050565b6000819050919050565b60ec8160db565b811460f657600080fd5b5056fea26469706673582212202155718f049537eeb007a6f90d13320064bd4989f47c4ff85c9042cc2257550164736f6c63430008000033\",\n ABI: (string) (len=280) \"[{\\\"inputs\\\":[],\\\"name\\\":\\\"get\\\",\\\"outputs\\\":[{\\\"internalType\\\":\\\"uint256\\\",\\\"name\\\":\\\"\\\",\\\"type\\\":\\\"uint256\\\"}],\\\"stateMutability\\\":\\\"view\\\",\\\"type\\\":\\\"function\\\"},{\\\"inputs\\\":[{\\\"internalType\\\":\\\"uint256\\\",\\\"name\\\":\\\"x\\\",\\\"type\\\":\\\"uint256\\\"}],\\\"name\\\":\\\"set\\\",\\\"outputs\\\":[],\\\"stateMutability\\\":\\\"nonpayable\\\",\\\"type\\\":\\\"function\\\"}]\",\n ContractName: (string) (len=13) \"SimpleStorage\",\n Errors: ([]string) \u003cnil\u003e,\n Warnings: ([]string) \u003cnil\u003e\n})\n```\n\n### Compilation Time\n\n```shell\nTime took: 3.309062ms\n```\n\n## Contributing\n\nWe welcome contributions from the community! Whether it's bug reports, feature requests, or code contributions, your involvement is highly appreciated.\n\n- **Reporting Bugs:** Before creating a bug report, please check if the issue has already been reported in the Issues section. If not, create a new one with a clear description and steps to reproduce the issue.\n- **Feature Requests:** If you have an idea to enhance the tool, feel free to share it in the [Issues](https://github.com/0x19/solc-switch/issues) section.\n- **Code Contributions:** If you wish to contribute code, please fork the repository, make your changes, and submit a pull request.\n\n\n## License\n\n**solc-switch** is licensed under the Apache License 2.0. You can read the full license [here](./LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0x19%2Fsolc-switch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F0x19%2Fsolc-switch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0x19%2Fsolc-switch/lists"}