# A Go/C Polyglot

DevFeed: [A Go/C Polyglot](<https://devfeed.tech/articles/a-go-c-polyglot-21941.md>)

Original publisher: [Read original article](<https://blog.nelhage.com/post/a-go-c-polyglot/>)

Author: Nelson Elhage

Published: 2019-09-05T23:42:28Z

Content type: article

Language: en

Sources: [Nelson Elhage](<https://devfeed.tech/sources/nelson-elhage.md>)

Topics: [Go Language](<https://devfeed.tech/topics/go-language.md>), [C](<https://devfeed.tech/topics/c.md>), [Parsing](<https://devfeed.tech/topics/parsing.md>)

Tags: [c](<https://devfeed.tech/tags/c.md>), [discovery](<https://devfeed.tech/tags/discovery.md>), [exploration](<https://devfeed.tech/tags/exploration.md>), [go](<https://devfeed.tech/tags/go.md>), [language](<https://devfeed.tech/tags/language.md>), [syntax](<https://devfeed.tech/tags/syntax.md>)

## AI overview

The article documents the author's exploration of how to create a source file that is valid in both Go and C. It examines the languages' specifications and focuses on differences in comment syntax as a possible way to construct the polyglot.

## Source excerpt

Writing a Go/C polyglot Someone on a Slack I'm on recently raised the question of how you might write a source file that's both valid C and Go, commenting that it wasn't immediately obvious if this was even possible. I got nerdsniped, and succeeded in producing one, which you can find here. I've been asked how I found that construction, so I thought it might be interesting to document the thought / discovery / exploration process that got me there.