impi
impi copied to clipboard
Ignore C directive in comments before 'import "C"`
If we have code like:
import (
"fmt"
"net/http"
"os"
goruntime "runtime"
"strings"
"unsafe"
"github.com/nuclio/nuclio/pkg/errors"
"github.com/nuclio/nuclio/pkg/processor/runtime"
"github.com/nuclio/logger"
"github.com/nuclio/nuclio-sdk-go"
)
/*
#include <Python.h>
#include <stdlib.h>
#include "types.h"
extern response_t call_handler(unsigned long event_ptr, unsigned long logger_ptr);
extern char *py_last_error();
void free_response_t(response_t response);
*/
import "C"
Then impi thinks there are 4 import groups due to the empty line in the comment before `import "C"
$ impi --local github.com/nuclio/nuclio/ --scheme stdLocalThirdParty ./cmd/... ./pkg/...
pkg/processor/runtime/python3/runtime.go: Expected no more than 3 groups, got 4
If we remove the empty line after #include "types.h" then impi is happy.
Do you think the proper method is to ignore import "C"?
Not sure. IMO import "C" is it's own group.