# workspace.Build

- **Module:** workspace
- **Package:** github.com/libtmux/libtmux-go/tmux
- **Language:** Go
- **Kind:** function
- **Source:** https://github.com/libtmux/libtmux-go/blob/5f808882015a975a65acc7f9da5b3ff0d5cbdc91/workspace/builder.go#L41
- **Page:** https://libtmux.org/reference/go/workspace-build/

```
workspace.Build(ctx: context.Context, server: tmux.Server, workspace: Workspace) -> (tmux.Session, error)
```

Build creates the workspace on server and returns the created session.

Build is not atomic. A failure after session creation returns that session;
completed mutations remain in tmux. Command failures are not normalized.

Build creates the session and an attached control connection in one process,
uses that connection for the build, and closes it before returning. The
returned Session is not bound to the closed connection. Build verifies that
the session remains reachable after closing it. An attached connection may
fire client hooks and policies.

Each pane receives workspace, window, and pane CommandsBefore, then its own
Commands. Sleep values pause Build rather than the pane.
