cmd/api: rewrite using go/types

- adjusted test files so that they actually type-check
- adjusted go1.txt, go1.1.txt, next.txt
- to run, provide build tag: api_tool

Fixes issue 4538.

R=bradfitz
CC=golang-dev
https://codereview.appspot.com/12300043