I recently interviewed for a software dev position at a company that seems to be really thrilled about me as a candidate, to the degree that they've been reading my blog and have openly told me that I'm the best candidate they've seen so far.

The lead dev invited me over for an on-site interview, without mentioning that he also wanted me to meet higher-ups later on. The in-person interview was between myself and the only two engineers on the team. It actually went really well!

Towards the end, the lead dev walked me out of the office; he basically summarized his stance and made it clear that they'd like to move forward (even mentioning the salary they'd offer).

He also said he'd like me to meet the CEO, but that he doesn't think my present attire would "leave the best impression" (I was wearing cargo shorts with a belt, and a dress shirt tucked in). He mentioned that he doesn't personally have a problem with my attire but that the CEO might.

I walked away feeling conflicted. On the one hand, they made it clear that they're really interested in me as a candidate. On the other hand, I'm jumped with a surprise offer to meet the CEO, but told to come back later once I've changed into slacks. This made me a little uncomfortable and, frankly, embarrassed.

Was this an appropriate comment, especially considering I was not clued in regarding what dress code I should expect or told that I would be meeting in such a formal setting (with the CEO)?

Edit: My location is Florida, for those who were asking. I didn't mention this initially for anonymity, but that was an oversight on my part as it seems to be relevant.