Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore C directive in comments before 'import "C"` #5

Open
tebeka opened this issue Feb 7, 2018 · 2 comments
Open

Ignore C directive in comments before 'import "C"` #5

tebeka opened this issue Feb 7, 2018 · 2 comments

Comments

@tebeka
Copy link
Contributor

tebeka commented Feb 7, 2018

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.

@pavius
Copy link
Owner

pavius commented Feb 7, 2018

Do you think the proper method is to ignore import "C"?

@tebeka
Copy link
Contributor Author

tebeka commented Feb 7, 2018

Not sure. IMO import "C" is it's own group.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants