gitwtfhub

wtf is goexpect?

tailscale/goexpect — explained in plain English

Analysis updated 2026-07-25 · repo last pushed 2023-10-28

11GoAudience · developerComplexity · 2/5DormantSetup · easy

TL;DR

A Go library that automates text-prompt interactions with programs like routers and FTP servers, letting your code wait for prompts and send responses automatically instead of typing them by hand.

Mindmap

mindmap
  root((repo))
    What it does
      Automates prompt interactions
      Spawns SSH or local sessions
      Batches multi-step workflows
    Testing features
      Fake Spawner for tests
      Simulates device responses
    Use cases
      Automate router configs
      Automate FTP transfers
      Network equipment automation
    Tech stack
      Go library
    Audience
      Network engineers
      Automation developers

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Why would anyone build with this?

REASON 1

Automate logging into dozens of routers to update their configurations.

REASON 2

Automate file transfers with an old FTP server that lacks a programmatic API.

REASON 3

Test automation logic against a simulated device before running on real systems.

What's in the stack?

Go

How it stacks up

tailscale/goexpectadguardteam/go-webextcandratama/tamagosh
Stars111111
LanguageGoGoGo
Last pushed2023-10-282026-06-25
MaintenanceDormantMaintained
Setup difficultyeasymoderateeasy
Complexity2/52/52/5
Audiencedeveloperdeveloperops devops

Figures from each repo's GitHub metadata at analysis time.

How do you spin it up?

Difficulty · easy Time to first run · 5min

Just add the Go package to your project, no external infrastructure or API keys required.

No license is specified in the README, so default copyright restrictions apply and you should contact the maintainers before using it.

Wtf does this do

Goexpect is a tool for automating interactions with programs that normally require a human to type responses at a prompt. Think of logging into a router over SSH, or connecting to a FTP server, where you have to wait for a "username:" prompt, type your username, wait for "password:", type your password, and so on. Instead of a person doing this manually, goexpect lets a Go program handle the whole conversation automatically. The way it works is based on a classic concept called "Expect," which has been around for decades. You start by launching or "spawning" a session, which could be a local process, an SSH connection, or a telnet session. Once connected, your program watches the incoming text and waits for a specific pattern, like "username:". When it sees that pattern, it sends a response, like your username. Then it watches for the next prompt and sends the next response. This send-and-expect cycle continues until the entire workflow is complete. You can also group these steps together into a "batch" to make multi-step interactions cleaner and easier to write. This project would be used by developers who need to automate interactions with network equipment, remote servers, or any system that relies on text-based prompts rather than a modern API. For example, a network engineer might use it to write a program that automatically logs into dozens of routers to update their configurations. A developer could also use it to automate file transfers with an old FTP server that doesn't have a programmatic interface. The project also includes a "Fake Spawner" specifically for testing. This lets a developer simulate a device or server's responses without actually connecting to anything, making it easier to verify that their automation logic works correctly before running it against real systems. The package is written in Go, and while it originated at Google, the README notes it is not an official Google product.

Yoink these prompts

Prompt 1
Write a Go program using goexpect that connects to a Cisco router over SSH, waits for the username and password prompts, logs in, and runs the 'show running-config' command.
Prompt 2
Using goexpect, create a batch that automates an FTP login and file download, waiting for each prompt before sending the next response.
Prompt 3
Show me how to use goexpect's Fake Spawner to simulate a device that asks for a username and password, so I can test my automation logic without connecting to a real server.
Prompt 4
Build a goexpect script that spawns a local CLI tool, waits for a specific prompt, sends a command, and prints the output.

Frequently asked questions

wtf is goexpect?

A Go library that automates text-prompt interactions with programs like routers and FTP servers, letting your code wait for prompts and send responses automatically instead of typing them by hand.

What language is goexpect written in?

Mainly Go. The stack also includes Go.

Is goexpect actively maintained?

Dormant — no commits in 2+ years (last push 2023-10-28).

What license does goexpect use?

No license is specified in the README, so default copyright restrictions apply and you should contact the maintainers before using it.

How hard is goexpect to set up?

Setup difficulty is rated easy, with roughly 5min to a first successful run.

Who is goexpect for?

Mainly developer.

View the repo → Decode another repo

This repo across BitVibe Labs

Don't trust strangers blindly. Verify against the repo.