Passage
But when I saw that they walked not uprightly according to the truth of the gospel, I said unto Peter before them all, If thou, being a Jew, livest after the manner of Gentiles, and not as do the Jews, why compellest thou the Gentiles to live as do the Jews?
Nearby Context
Galatians 2:12 For before that certain came from James, he did eat with the Gentiles: but when they were come, he withdrew and separated himself, fearing them which were of the circumcision.
Galatians 2:13 And the other Jews dissembled likewise with him; insomuch that Barnabas also was carried away with their dissimulation.
Galatians 2:14 But when I saw that they walked not uprightly according to the truth of the gospel, I said unto Peter before them all, If thou, being a Jew, livest after the manner of Gentiles, and not as do the Jews, why compellest thou the Gentiles to live as do the Jews?
Galatians 2:15 We who are Jews by nature, and not sinners of the Gentiles,
Galatians 2:16 Knowing that a man is not justified by the works of the law, but by the faith of Jesus Christ, even we have believed in Jesus Christ, that we might be justified by the faith of Christ, and not by the works of the law: for by the works of the law shall no flesh be justified.
Study Lenses
The verse centers on "walked", "uprightly", "truth", "gospel", "said", "peter", "before", and "thou". It is saying that the verse draws attention to "walked" and "uprightly", so its meaning should be read from those terms before moving to application.
The nearby context moves from verse 13's "And the other Jews dissembled likewise with..." into verse 15's "We who are Jews by nature and...", so "walked" and "uprightly" belong inside that flow. In Galatians context, the local focus is Christ, faith, and discipleship.
A plain takeaway is to answer the verse's own emphasis on "walked" and "uprightly" with trust shaped by these words, not by a vague optimism outside the passage.