The rules are, as you observed, unclear about it, which leaves us with... **Up to the DM**. Now, from how I read/understand it:

**Everything on the readied action must have been decided the moment you readied it.** In particular for your example, "I attack" is not a (complete) action; "I attack the goblin" or "I attack the Bugbear" are. This is backed by the reading

>Then, you choose the action you will take in response to that trigger

and

>When the trigger occurs, you can either take your reaction right after the trigger finishes or ignore the trigger.

Note that nowhere it states that you can make any change or add any detail to the action you are taking when the trigger happens - or when you take your reaction. That means you can't simply change your action from "I attack" to "I attack the Bugbear", from how I understand it. 

For explaining better this reading, the intention for the ready action seems to be to delay an action that you could take in your own turn. If you simply said "I attack" as an action in your turn, your DM would simply ask "**Who?**". If you say "I get ready to attack", I would ask the same question - attack who?

-----------

For the Cast a Spell rule you mention, it is a specific rule for the spell case. It does not set and should not be used to set a precedent for the general rule. [I have made the same mistake before][1]. But for that case, you need to specify the spell slot and (possibly) the target, as when you ready the spell, you are already casting it (reason you lose the spell slot even if the trigger doesn't happen), you simply are not **releasing** it yet. 


  [1]: https://rpg.stackexchange.com/q/123507/43856