All Projects → rinchsan → gosimports

rinchsan / gosimports

Licence: BSD-3-Clause license
alias goimports='gosimports'

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to gosimports

Nodetube
Open-source YouTube alternative that offers video, audio and image uploads, livestreaming and built-in monetization
Stars: ✭ 2,066 (+2938.24%)
Mutual labels:  alternative
Hyperhtml
A Fast & Light Virtual DOM Alternative
Stars: ✭ 2,872 (+4123.53%)
Mutual labels:  alternative
sane
make, but sane.
Stars: ✭ 15 (-77.94%)
Mutual labels:  alternative
alternative-front-ends
Overview of alternative open source front-ends for popular internet platforms (e.g. YouTube, Twitter, etc.)
Stars: ✭ 1,664 (+2347.06%)
Mutual labels:  alternative
alternativeto
A comprehensive list of alternatives to your favorite software
Stars: ✭ 29 (-57.35%)
Mutual labels:  alternative
Arteries
A procedural modeling toolkit base on UE4 blueprint
Stars: ✭ 92 (+35.29%)
Mutual labels:  alternative
cargo-esr
Extended Search & Ranking tool for crates.
Stars: ✭ 23 (-66.18%)
Mutual labels:  alternative
imperial
Official mono-repo for https://imperialb.in/
Stars: ✭ 35 (-48.53%)
Mutual labels:  alternative
Shopixl
Open-source, self-hosted, Buycraft alternative
Stars: ✭ 17 (-75%)
Mutual labels:  alternative
careful rm
A safe wrapper for rm that adds useful warnings and an optional recycle/trash mode
Stars: ✭ 22 (-67.65%)
Mutual labels:  alternative
abaddon
An alternative Discord client made with C++/gtkmm
Stars: ✭ 333 (+389.71%)
Mutual labels:  alternative
tb-grid
tb-grid is a super simple and lightweight 12 column responsive grid system utilizing css grid.
Stars: ✭ 19 (-72.06%)
Mutual labels:  alternative
CalDOM
An agnostic, reactive & minimalist (3kb) JavaScript UI library with direct access to native DOM.
Stars: ✭ 176 (+158.82%)
Mutual labels:  alternative
Mat-O-Wahl
🇩🇪 Mat-O-Wahl - Ein einfach zu bedienender, freier Open Source Wahl-O-Mat Klon fuer jedermann ### 🇬🇧 🇺🇸 A simple to handle, free "Voting Advice Application" / "Electoral Compass" alternative
Stars: ✭ 27 (-60.29%)
Mutual labels:  alternative
Adware-ads-network-server
Online Advertising Network Server
Stars: ✭ 44 (-35.29%)
Mutual labels:  alternative
KDynamic
An Alternative to MacOS Mojave Dynamic Theme and Wallpaper Changer
Stars: ✭ 48 (-29.41%)
Mutual labels:  alternative
Golite
Add essential language support for the Go language to Sublime Text 3.
Stars: ✭ 14 (-79.41%)
Mutual labels:  goimports

Note APIs are likely to change a few times before we reach 1.0.0

gosimports - simpler goimports

  • 🚀 Drop-in replacement for goimports
  • 💯 Prettier than goimports
  • 🔨 Originally forked from golang.org/x/tools/cmd/goimports

Motivation

This gosimports provides one solution to the goimports grouping/ordering problem.

Installation

Go

go install github.com/rinchsan/gosimports/cmd/gosimports@latest

Homebrew

brew install rinchsan/tap/gosimports

Binary

Download binaries from GitHub Releases

Example

import (
	"bufio"

	// basic comments

	/*
		block comments
	*/

	"github.com/rinchsan/gosimports/internal/imports"

	"errors"
	gocmd "github.com/rinchsan/gosimports/internal/gocommand"
	"flag"

	"runtime"
	_ "runtime/pprof" // trailing inline comments
	"strings"

)

$ gosimports -w 👍

import (
	"bufio"
	"errors"
	"flag"
	"runtime"
	_ "runtime/pprof" // trailing inline comments
	"strings"

	gocmd "github.com/rinchsan/gosimports/internal/gocommand"
	"github.com/rinchsan/gosimports/internal/imports"
)

while goimports formatting like below 👎

import (
	"bufio"

	// basic comments

	/*
		block comments
	*/

	"github.com/rinchsan/gosimports/internal/imports"

	"errors"
	"flag"

	gocmd "github.com/rinchsan/gosimports/internal/gocommand"

	"runtime"
	_ "runtime/pprof" // trailing inline comments
	"strings"
)

Module Usage

Installation

go get github.com/rinchsan/gosimports

Example

package main

import (
	"os"

	"github.com/rinchsan/gosimports"
)

func main() {
	src, err := os.ReadFile("gosimports.go")
	if err != nil {
		// error handling
	}

	formatted, err := gosimports.Process("", src, nil)
	if err != nil {
		// error handling
	}

	if err := os.WriteFile("gosimports.go", formatted, 0644); err != nil {
		// error handling
	}
}

License

Copyright 2013 The Go Authors. All rights reserved.

Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].