MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / go_import_path

Function go_import_path

internal/cbm/doclink_go.c:1701–1718  ·  view source on GitHub ↗

The content of an import path literal; NULL when it is none this scan can * record (not a plain string, empty, too long, or with bytes no path has). */

Source from the content-addressed store, hash-verified

1699/* The content of an import path literal; NULL when it is none this scan can
1700 * record (not a plain string, empty, too long, or with bytes no path has). */
1701static const char *go_import_path(const go_scan_t *s, TSNode lit, size_t *len) {
1702 const char *t = go_node_span(s, lit, len);
1703 if (*len < PAIR_LEN || (t[0] != '"' && t[0] != '`') || t[*len - SKIP_ONE] != t[0]) {
1704 return NULL;
1705 }
1706 t++;
1707 *len -= PAIR_LEN;
1708 if (*len == 0 || *len > GO_PATH_MAX) {
1709 return NULL;
1710 }
1711 for (size_t i = 0; i < *len; i++) {
1712 unsigned char c = (unsigned char)t[i];
1713 if (c <= ' ' || c == '\\' || c == '"' || c == '`' || c == GO_ASCII_DEL) {
1714 return NULL;
1715 }
1716 }
1717 return t;
1718}
1719
1720static void go_scan_import_spec(go_scan_t *s, TSNode spec) {
1721 size_t path_len = 0;

Callers 1

go_scan_import_specFunction · 0.85

Calls 1

go_node_spanFunction · 0.85

Tested by

no test coverage detected