# append(s, x) evaluated but not used

- **ID:** `go/append-to-slice-without-assignment`
- **Domain:** go
- **Category:** compile_error
- **Verification:** ai_generated
- **Fix Rate:** 95%

## Root Cause

The append() function returns a new slice; ignoring the return value discards the result and the original slice remains unchanged, leading to a compile-time error.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| Go 1.20 | active | — | — |
| Go 1.21 | active | — | — |
| Go 1.22 | active | — | — |

## Workarounds

1. **Assign the result of append back to the slice: s = append(s, x). Ensure s is used later in the code.** (95% success)
   ```
   Assign the result of append back to the slice: s = append(s, x). Ensure s is used later in the code.
   ```
2. **If you want to modify the slice in place, use copy or index assignment instead: s = append(s[:len(s):len(s)], x) to extend capacity.** (85% success)
   ```
   If you want to modify the slice in place, use copy or index assignment instead: s = append(s[:len(s):len(s)], x) to extend capacity.
   ```
3. **Use a pointer to the slice if you need to modify it inside a function: func foo(s *[]int) { *s = append(*s, x) }** (90% success)
   ```
   Use a pointer to the slice if you need to modify it inside a function: func foo(s *[]int) { *s = append(*s, x) }
   ```

## Dead Ends

- **** — The error 'evaluated but not used' will still occur because s is not used after assignment. (70% fail)
- **** — The same compile-time error occurs regardless of goroutine; append still returns an unused value. (90% fail)
- **** — This compiles but discards the result, which is likely a logic bug; the original slice s remains unchanged. (50% fail)
