Skip to content

Option to pass a string variable into PluckString? #7

@Hovelander

Description

@Hovelander

Embarrassing, but I can admit it.

I suck...

Thanks for the brilliant code and apologies for opening an issue.

edit:

Well, I suck a little less than I thought.

I'm importing Pluck as a pkg into some code I am writing with github.com/chromedp/chromedp as my browser driver. PluckString is definitely getting the correct string content from a variable if I print that variable to console after loading a page with chromedp and grabbing a chunk or reactID that I need.

Any ideas for a newb who can get a correct map from (if I first write the same var to a file):

p.Load("config.toml")
p.PluckFile("testpluck.txt")
fmt.Println(p.Result())

But not from this?:

//code that correctly loads desired string into var html here before and after using strconv.Quote.
p.PluckString(html)   // <------- PluckString won't take the string var html here for some reason  
fmt.Println(p.Result())

I am sure that I am just doing something stupid, but can't find out why PluckString would need a string literal in the code "p.PluckString("here")" and won't take a string var "p.PluckString(here)".

Any advice for a newb?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions