Mr. Goldman, a Democrat from New York City, faces a stiff primary battle that could turn on Gaza and how to fight President Trump.