Skip to content
Myr

functions.go

This file

Path

src/functions.go

35 lines · 675 bytes · Go

Last changed by

Add --tmux option to replace fzf-tmux scriptJunegunn Choibefore adoption83b6033

History of this file

Take it

Refactor the code to remove global variablesJunegunn Choibefore adoption4bedd33

lines 1–9why, one step back
1package fzf
23import (4 "os"5 "strings"6 "unsafe"7)89func writeTemporaryFile(data []string, printSep string) string {

Add --tmux option to replace fzf-tmux scriptJunegunn Choibefore adoption83b6033

line 10why, one step back
10 f, err := os.CreateTemp("", "fzf-temp-*")

Refactor the code to remove global variablesJunegunn Choibefore adoption4bedd33

lines 11–35why, one step back
11 if err != nil {
12 // Unable to create temporary file13 // FIXME: Should we terminate the program?14 return ""15 }16 defer f.Close()1718 f.WriteString(strings.Join(data, printSep))19 f.WriteString(printSep)20 return f.Name()21}2223func removeFiles(files []string) {24 for _, filename := range files {25 os.Remove(filename)26 }27}2829func stringBytes(data string) []byte {30 return unsafe.Slice(unsafe.StringData(data), len(data))31}3233func byteString(data []byte) string {34 return unsafe.String(unsafe.SliceData(data), len(data))35}