type state … func isTerminal(fd int) bool { … } func makeRaw(fd int) (*State, error) { … } func getState(fd int) (*State, error) { … } func restore(fd int, state *State) error { … } func getSize(fd int) (width, height int, err error) { … } type passwordReader … func (r passwordReader) Read(buf []byte) (int, error) { … } func readPassword(fd int) ([]byte, error) { … }