Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Anton Pyrogovskyi qrntz

🏠
Working from home
Block or report user

Report or block qrntz

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@qrntz
qrntz / error.go
Created Nov 23, 2019
go error monad
View error.go
package main
import (
"errors"
"log"
)
type F func() error
func errCompose(pipeline ...F) (e error, ok bool) {
@qrntz
qrntz / gofmt.vim
Last active Sep 3, 2019
A complete, plugin-free method to gofmt code on write
View gofmt.vim
" this reloads the file after formatting
" while preserving current view and undo history
function! GoFmtSave()
:undoj " do not create undo history entry
let l:oldx = getpos("'x") " save current x mark
let l:oldy = getpos("'y") " save current y mark
:norm! mxHmy " mark current position and top of screen
!gofmt -w % " call gofmt on the current file
:e " reload file
You can’t perform that action at this time.