Giter VIP home page Giter VIP logo

go-solc-select's Introduction

Go-solc-select GoDoc

The work is inspired by the Solc-select tool for managing and switching between versions of the Solidity compiler, which I actively use in my work. However, what has a significant disadvantage for me is the dependence on Python or the need to use Docker as an isolating environment.

About

Go-solc-select - is a simple program that installs the Solidity compiler and switches between them. This can be a useful tool for managing different versions of the Solidity compiler, checking available versions for a particular operating system. It is designed to be easy to install and use.

The tool is split into two CLI utilities:

  • gsolc-select: manages installing and setting different solc compiler versions
  • solc: wrapper around solc which picks the right version according to what was set via gsolc-select

The solc binaries are downloaded from https://binaries.soliditylang.org/ which contains official artifacts for many historial and modern solc versions for Linux and macOS.

The downloaded binaries are stored in ~/.gsolc-select/artifacts/.

Platforms

Go-solc-select is designed for use on Unix/Linux/POSIX systems as a command line tool.

Installation

Go-solc-select requires go1.17 to install successfully. Run the command below to install the latest version.

To install gsolc-select:

go install -v github.com/fabelx/go-solc-select/cmd/gsolc-select@latest

To install solc wrapper:

go install -v github.com/fabelx/go-solc-select/cmd/solc@latest

Usage

gsolc-select --help

This will display help for the gsolc-select.

gsolc-select

  Allows users to installer and quickly switch between Solidity compiler versions

Usage:
  gsolc-select [command]

Examples:
  gsolc-select versions current - get current solc version
  gsolc-select install 0.8.1 - install a solc compiler
  gsolc-select use 0.8.1 - switch current version to 0.8.1
  gsolc-select uninstall 0.8.1 - remove solc compiler
  gsolc-select uninstall 0.8.1 0.8.17 -v - remove solc compilers verbose
  gsolc-select versions - get installed solc compiler versions
  gsolc-select versions installable - get installable solc compiler versions for current platform (OS)


Available Commands:
  completion  Generate the autocompletion script for the specified shell
  help        Help about any command
  install     Install available solc versions
  uninstall   Remove installed solc versions
  use         Change the version of global solc compiler
  versions    Installed solc versions

Flags:
  -h, --help      help for gsolc-select
  -j, --json      indicate if you want to use json format for logging details
  -s, --verbose   indicate if you want for log details
  -v, --version   version for gsolc-select

  Use "gsolc-select [command] --help" for more information about a command.

Usage

package main

import (
	"context"
	"github.com/fabelx/go-solc-select/pkg/installer"
	"github.com/fabelx/go-solc-select/pkg/uninstaller"
	"github.com/fabelx/go-solc-select/pkg/versions"
	"os/signal"
	"syscall"
)

func main() {
	// Get available versions
	available, err := versions.GetAvailable()
	if err != nil {
		return
	}

	var versionsToInstall []string
	for key, _ := range available { 
		versionsToInstall = append(versionsToInstall, key)
	}

	// Setup context
	ctx, stop := signal.NotifyContext(context.Background(), syscall.SIGTERM, syscall.SIGINT)
	defer stop()

	// Install all available versions 
	i, _, err := installer.InstallSolcs(ctx, versionsToInstall)
	if err != nil {
		return
	}
	
	// Uninstall installed versions
	_, _, err = uninstaller.UninstallSolcs(i)
	if err != nil {
		return 
	}
}

New Features coming soon! ๐ŸŽ‰๐ŸŽ‰๐ŸŽ‰

  • Download Solcs in asynchronous and synchronous modes
  • Force shutdown and clean up

License

Go-solc-select is released under the GNU Affero General Public License v3.0. See the LICENSE file for license information.

Star History

Star History Chart

go-solc-select's People

Contributors

dependabot[bot] avatar fabelx avatar spking11 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

go-solc-select's Issues

Add license flag

Create a new option/flag to view license information.

-l,   --license            show licensing information and exit

Graceful shutdown

Add a system interrupt handler for the program. As well as clearing data when the compiler installation is interrupted.

ch := make(chan os.Signal, 1)
signal.Notify(ch, syscall.SIGTERM, syscall.SIGINT)

go func() {
	_ = <-ch
	fmt.Println("Graceful shutdown...")
	os.Exit(1)
}()

Add version command

Is your feature request related to a problem? Please describe.
Lack of understanding which version of gsolc-select is installed (cli part).

Describe the solution you'd like
Add new command - version.

Displays the version of this gsolc-select binary and exits.

Usage:
   gsolc-select version [flags]

Asynchronous installation

Sequential installation of compilers takes a lot of time.

gsolc-select install all

or

gsolc-select install 0.8.0 0.8.1 0.4.5

Increase installation speed by implementing an asynchronous approach.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.